1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

PHP Date Function

Discussion in 'Plesk 10.x for Linux Issues, Fixes, How-To' started by CJZ, Jul 6, 2011.

  1. CJZ

    CJZ Basic Pleskian

    14
    85%
    Joined:
    Apr 27, 2011
    Messages:
    38
    Likes Received:
    0
    After upgrading to Plesk Panel 10.3, each subscription running as a CGI or FastCGI module now gives a PHP error for the date handling.

    Code:
    Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /var/www/vhosts/.../httpdocs/libraries/joomla/utilities/date.php on line 198
    
    The timezone is set in the server's php.ini. How can I fix this problem and still have the sites hosted as CGI?
     
    Last edited: Jul 6, 2011
  2. IgorG

    IgorG Forums Analyst Staff Member

    49
    24%
    Joined:
    Oct 27, 2009
    Messages:
    24,572
    Likes Received:
    1,243
    Location:
    Novosibirsk, Russia
    Make sure that you have in php.ini:

    session.auto_start = 0
     
  3. CJZ

    CJZ Basic Pleskian

    14
    85%
    Joined:
    Apr 27, 2011
    Messages:
    38
    Likes Received:
    0
    The following is already indicated in the php.ini

    Code:
    ; Initialize session on request startup.
    session.auto_start = 0
     
  4. danliker

    danliker Silver Pleskian Plesk Certified Professional

    33
    43%
    Joined:
    Feb 15, 2006
    Messages:
    575
    Likes Received:
    0
    Location:
    Switzerland
    i think you need to set timezone in your php.ini

    as an example for switzerland you need to add:
    date.timezone = "Europe/Zurich"

    please read:
    http://www.php.net/manual/en/datetime.configuration.php

    please not that in some linux distributions you have different php.ini files for cli / cgi / apache ...
     
    Last edited: Jul 8, 2011
  5. CJZ

    CJZ Basic Pleskian

    14
    85%
    Joined:
    Apr 27, 2011
    Messages:
    38
    Likes Received:
    0
    I am running on a Centos 5 linux which seems to have the CGI /Apache/ FCGI all run from the same global php.ini (/etc/php.ini). I also have the following stated in the php.ini:
    Code:
    [Date]
    ; Defines the default timezone used by the date functions
    date.timezone = America/New_York
    Apache service has been rebooted after applying the time zone. The sites work running under apache, I need them to run under CGI.

    Thanks.
     
  6. CJZ

    CJZ Basic Pleskian

    14
    85%
    Joined:
    Apr 27, 2011
    Messages:
    38
    Likes Received:
    0
    Here are all the error codes that appear on my site(s) when they are running as a CGI or FCGI script.

    Code:
    arning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /var/www/vhosts/.../httpdocs/libraries/joomla/utilities/date.php on line 56
    
    Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /var/www/vhosts/z.../httpdocs/libraries/joomla/utilities/date.php on line 198
    
    Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /var/www/vhosts/.../httpdocs/libraries/joomla/utilities/date.php on line 198
    I need help correcting this issue as soon as possible. Thank you.

    Feel free to ask for more information on the server configuration if it'll help with the solution.


    -->> EDIT <<--

    After further searching, when they are running as a CGI/FCGI script they pull the php.ini from ../vhosts/.../etc/php.ini for each site. How can these easily be managed or have it stay pointed at the master php.ini?
    Code:
    Server API	CGI/FastCGI
    Virtual Directory Support	disabled
    Configuration File (php.ini) Path	/etc
    Loaded Configuration File	/var/www/vhosts/z.../etc/php.ini
    Also, the php.ini files are root:root so they cannot be modifies in the Plesk file manager for the users.
     
    Last edited: Jul 9, 2011
Loading...