Month: October 2011

  • [How To] Update or Change MySQL Server Time Zone

    In this article will, we will go through the various options to change or update the MySQL server database timezone on the Linux, Unix servers. The MySQL timezone can be either updated globally or only for specific database. Hope this article will be useful to my fellow administrators getting request to change MySQL database server timezone in day to day activities.

    The below steps should guide you to change / update the MySQL database server time zone:

    Prerequisites

    • Click here for the MySQL supported timezone.
    • Click here for list of PHP supported timezone.
    • Server shell access for SSH with root privileges.
    • Check time_zone tables in MySQL database server. If it is empty then insert Zone Info data using following command: (optional)
     mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql

    Systems like Linux, FreeBSD, Solaris, and Mac OS X stores zone information at /usr/share/zoneinfo directory. Else refer to https://dev.mysql.com/downloads/timezones.html for more details

    To change / update MySQL database server timezone globally:

    Execute below command with super admin privileges to set global timezone i.e. applicable for all databases present on the server

    mysql>SET GLOBAL time_zone = timezone;

    Example:

    In the below example, the timezone will be set to America/Los_Angeles. Replace timezone value with the desired time zone you want to set.

    mysql>SET GLOBAL time_zone = "America/Los_Angeles";

    To change / update MySQL database timezone only for a user session / single database:

    Select the database and execute below command

    mysql>SET time_zone = timezone;

    Example:

    mysql>SET time_zone = Europe/London;

    The timezone will be set to Europe/London in the above example.

    To change / update MySQL database server timezone globally using my.cnf configuration file

    • Open the my.cnf configuration in your favorite editor using admin privileges
    vi /etc/my.cnf
    • Insert the below line in the configuration file.
    default_time_zone=timezone

    Example:

    default_time_zone=Asia/Calcutta

    where timezone will be set to Asia/Calcutta.

    Don't forget to restart MySQL server!

    Please comment if you have any queries or suggestions, we will be happy to hear from you.

    Review Overview

    User Rating: 3.08 ( 2 votes)
  • [How To] Change or update Apache time zone

    If websites are hosted on shared servers and timezone is different, one may demand to change the timezone for his/her website.

    In this case, there is no need to change the timezone on the server. We can change the timezone for the particular website using following methods.

    The Apache time zone can be updated in two ways:

    1) Using PHP configuration file php.ini

    2) Using .htaccess file

    Let us see each of them in detail:

    Updating time zone using php.ini file

    1) Check the global php,ini file location on the server

    php -i | grep php.ini

    2) Open php.ini for editing

    vi php.ini

    3) Search for "date.timezone"

    4) Update the time zone

    date.timezone="Asia/Kolkata"

    Refer PHP supported timezone here.

    5) Save the file

    6) Restart Apache service

    Note: Custom php.ini can be used instead of editing global php.ini on the server.

    Updating time zone using .htaccess

    1) Open .htaccess file present under the document root. If not present already, then create a new file.

    2) Add line

    SetEnv TZ timezone

    where timezone is the timezone you wish to set.

    Refer PHP supported timezones here.

    3) Save the file

    Hope this helps!

    Review Overview

    User Rating: 4.9 ( 2 votes)
  • [How To] Change mail server IP in WHM cPanel

    Sometimes mail server IP gets blacklisted in the RBL's which causes inconvenience to send / receive emails. To overcome the problem, the mail server IP can be changed so that emails will work fine.

    To change mail server IP in WHM cPanel:

    1) Login to WHM and got to WHM >> Main >> Service Configuration >> Exim Configuration Editor >> Domains and IPs , enable option "Send outgoing mail from the ip that matches the domain name in /etc/mailips"

    2) Login in the server as a root user using shell and open file /etc/mailips for editing which will display something like this

    *: 111.111.111.111

    Replace 111.111.111.111 with the new mail server IP and save the file.

    3) Restart exim service

    /etc/init.d/exim restart

    If any feedback, queries are always welcome!

    Review Overview

    User Rating: Be the first one !
  • How to fix "Warning: Cannot modify header information - headers already sent by"

    php logoIf you are getting error as

    "Warning: Cannot modify header information - headers already sent by"

    then open the php.ini file of the domain.

    Check "output_buffer" value in php.ini and alter the current settings (turn On/Off)

    Also, increase "maximum_execution_time" to 300.

    Save the php.ini file and restart apache service.

    If any feedback, queries are always welcome!

  • How to fix error "suhosin.so: undefined symbol: zend_atol"

    php logoSuhosin is an advanced protection system for PHP installations. It was designed to protect servers and users from known and unknown flaws in PHP applications and the PHP core.

    If you are getting error as

    /usr/bin/php: symbol lookup error: /usr/local/lib/php/extensions/no-debug-non-zts-20060613/suhosin.so: undefined symbol: zend_atol
    [Sun Jan 30 11:07:08 2011] [error] [client] Premature end of script headers: /home/username/public_html/wp-admin/index.php

     

    You will have to disable suhosin for the domain in the problem. It works when you enable suhosin.simulation for the account instead of disabling suhosin on the server.

    1) open php.ini file

    2) Locate

    extension="suhosin.so"

    and change to

    ;extension="suhosin.so"

    3) Add the following line

    suhosin.simulation On

    4) Save the file and restart apache service.

    If any feedback, queries are always welcome!

Back to top button