Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#2880 date.timezone error

closed-rejected
Gerry Kroll
None
5
2011-10-03
2011-09-30
sahin
No

Environment: PhpGedView Version 4.2.4, PHP Version 5.3.5, Apache under Windows

Problem: getting "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."

Cause: (official explanation at http://php.net/manual/en/function.date-default-timezone-set.php\) Since PHP 5.1.0 (when the date/time functions were rewritten), every call to a date/time function will generate a E_NOTICE if the timezone isn't valid, and/or a E_WARNING message if using the system settings or the TZ environment variable.

Solutions:
1. modifying php.ini file by finding the line “date.timezone =”, uncomment it, and set the value like
date.timezone = “Europe/Istanbul”;
2. modifying config.php file by adding a line like
date_default_timezone_set('Europe/Istanbul');
Since the first solution needs admin privilages for the server, the second way is more convenient.

Request:
There should be a variable for timezone in config.php which is set to a default value if no local value is found. This value should also from admin.php

Discussion

  • Gerry Kroll
    Gerry Kroll
    2011-10-03

    This is not a PhpGedView bug, and has been discussed many times.

    When the problem is applicable not only to PhpGedView but to other PHP scripts as well, the solution MUST be implemented outside the PhpGedView program. It's not reasonable to fix each PHP program individually.

    The correct solution is to apply the change to the php.ini file. This is also what other "authorities" recommend.

    Note:
    This is one of many "improvements" forced upon us by the PHP developers. Unfortunately, there's little we can do about this, other than to follow the documented recommendations.

     
  • Gerry Kroll
    Gerry Kroll
    2011-10-03

    • assigned_to: nobody --> canajun2eh
    • status: open --> closed-rejected