Results 1 to 2 of 2
  1. #1

    Mismatch in time between the server and apps

    Thought of sharing this with all.

    Issue:

    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

    Code:
    <?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.

    Code:
    [[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 :

    Code:
    [[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.

    Code:
    [[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://pecl.php.net/timezonedb-2009.6
    configuration option “php_ini” is not set to php.ini location
    You should add “extension=timezonedb.so” to php.ini
    ==========================

    So , add the line ” extension=timezonedb.so” to the php.ini file and restart apache.

    There shouldn’t be any mismatch in time now.

  2. #2
    Join Date
    Jun 2009
    Location
    Kochi,India
    Posts
    177
    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*
    AdMod.com -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
  •