Deep analysis of PHP 5.3.x strtotime () Time zone setting warning information repair _php tips

Source: Internet
Author: User

PHP Warning:
Strtotime (): It isn't safe to rely on the system's timezone settings. You are are *required* to use the Date.timezone setting or the Date_default_timezone_set () function. In case you are used any of those methods and your are still getting this warning, for you most likely misspelled the timezone Iden Tifier. We selected ' asia/chongqing ' for ' cst/8.0/no DST ' instead in/var/www/cacti/index.php
Looked up some information, said that the PHP version is too high, in the new version must specify timezone and so on.

The specific mode of operation is as follows:
1, in the PHP configuration file to add TimeZone configuration
(Refer to Debian configuration rules, add a small configuration rule file, good maintenance, customization good)
~# Vim/etc/php/cli-php5.3/ext-active/date_timezone.ini
Date.timezone = "Asia/shanghai"
~ # Env-update
~ # Source/etc/profile
The custom files are placed in the Cli-php5.3/ext-active directory because PHP is by default CLI, and the Ext-active directory is a private directory that represents the enabled feature, which can be seen from the/etc/env.d/20php5.3 file
Manpath= "/usr/lib/php5.3/man/"
config_protect_mask= "/etc/php/cli-php5.3/ext-active//etc/php/cgi-php5.3/ext-active//etc/php/apache2-php5.3/ ext-active/"

2, in the error prompted the php file to add date_default_timezone_set (' Asia/shanghai '); location in Shanghai, China

Note:
In some references it is said that the two methods can be selected, but after my test, two methods must be used at the same time, no more error prompts.

In fact, the second method does not need to be added in each PHP file with error prompts, just add it to one of the PHP files. Additional time zones do not need to be the same as the time zone in the hint, such as the system gave me the hint is Chongqing, but I set to Shanghai is the same, of course, this time is the same as my system's time zone settings are the same.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.