Fix PHP "It is not safe to rely on the system ' s timezone settings" problem, Relytimezone
If you use more than PHP5.3, the PHP Date function error will appear if you do not have the correct configuration php.ini. Before many old PHP programming tutorials did not mention this problem, so many readers will be confused, the following author for everyone to talk about the three ways to solve this problem.
"PHP Warning:
Date () [Function.date]: It is not safe for rely on the system ' s timezone settings.
You is *required* to use the date.
TimeZone setting or the Date_default_timezone_set () function.
In case you used any of the those methods and you is still getting this warning,
You are most likely misspelled the timezone identifier.
We selected ' UTC ' for ' 8.0/no DST ' instead in '
In fact, from PHP 5.1.0, when a function such as date () is used, if timezone is set incorrectly, E_notice or e_warning information is generated every time the function is called. And in PHP 5.1.0, date.timezone This option, by default, is turned off, no matter what PHP command is Greenwich Mean time, but PHP 5.3 as if there is no setting will be forced to throw the error, to solve this problem, as long as the localization on the line.
First, use Date_default_timezone_set () to set Date_default_timezone_set (' PRC ') on the page header; East Eight time zone echo
Date (' y-m-d h:i:s ');
Second, use Ini_set (' Date.timezone ', ' Asia/shanghai ') in the head of the page;
Third, modify the php.ini (if it is a Windows system, then the file in the C disk, Windows directory, if the system is installed on the C drive). Use Notepad to open php.ini find Date.timezone Remove the previous semicolon modification to become: Date.timezone = PRC
Restart the HTTP service (such as Apache2 or IIS)!
Choose one of the above three methods, and a third method is recommended, so you don't need to add extra code each time.
http://www.bkjia.com/PHPjc/1058148.html www.bkjia.com true http://www.bkjia.com/PHPjc/1058148.html techarticle solve PHP "It is not safe to rely on the system ' s timezone settings" issue, Relytimezone if you use PHP5.3 above, if there is no correct configuration php.ini will appear. ..