Results 1 to 2 of 2
  1. #1

    Mismatch in time between the server and apps

    Thought of sharing this with all.


    Php function was returning wrong time. There was a difference of 1 hour between the server time and the php time. Due to this ,most of the functions on the site were not working properly.

    Fix :

    For checking the php time, put the following code in a file, say time.php

        $time = time();
        $result = date(”Y-m-d (D) H:i:s”,$time);
        echo “Current date and local time on  server = $result   “;
    Execute the php script.

    [[email protected] ~]# php -a time.php
        Interactive mode enabled
        Current date and local time on  server = 2017-01-30 (Mon) 18:04:25
    To get the server time , issue the following command :

    [[email protected] ~]# date
        Mon Jan 30 17:04:25 IST 2017
    You can see the difference of one hour between the server time and the php time.
    For fixing this, you need to install the PECL timezonedb module.

    [[email protected] ~]# pecl install timezonedb
    At the end , you might see the following message :

    Build process completed successfully
    Installing ‘/usr/local/lib/php/extensions/no-debug-non-zts-20060613/timezonedb.s o’
    install ok: channel://
    configuration option “php_ini” is not set to php.ini location
    You should add “” to php.ini

    So , add the line ”” to the php.ini file and restart apache.

    There shouldn’t be any mismatch in time now.

  2. #2
    Join Date
    Jun 2009
    thanks, that was a good piece of information
    Ezeelogin -
    The ultimate multiple server administration software.
    *Parallel shell *rm -rf protection *SSH logging*automated password changes*encrypted storage* -Delivering innovative web hosting solutions

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts