PHP configuration Datetime.zone Attention Point ____php

Source: Internet
Author: User
Tags echo date

1, idle to do the east of PHP, today took the next PHP operating environment, in the test date function when the old newspaper the following error:

"PHP warning:date () [function.date]: It is isn't safe to rely on the system ' 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 ' UTC ' for ' 8.0/no DST ' instead in ' XXX

On the Internet to check the data, the solution has 3:1, in the page using Date_default_timezone_set () Set Date_default_timezone_set (' PRC '); East Eight time zone echo date (' y-m-d h:i:s '); Second, the use of Ini_set (' Date.timezone ', ' Asia/shanghai ') in the head of the page; Third, modify the php.ini. Open Php5.ini Find Date.timezone Remove the preceding semicolon modification to become: Date.timezone =PRC or Asia/shanghai

Look at the next php.ini there's a datetime.zone option:

[Date]
; Defines the default timezone used by the date functions
; Http://php.net/date.timezone
;d Ate.timezone =

Visit Http://php.net/date.timezone can see the relevant content, which refers to the time zone of the "configuration of the":

Shanghai, the Asia
Date.timezone = "Asia/shanghai"
Date.default_latitude = 31.5167
Date.default_longitude = 121.4500

After the configuration, restart Apache, run looked at, or reported the same mistake, that is, the change of things did not take effect, but tried the other two methods is possible.

Later in the Apache configuration file httpd.conf configuration support PHP Add: Phpinidir "d:/php5.4.7" Problem resolution

What is the role of Phpinidir when Apache is set up?
Unlike the PHP4 search php.ini is%systemroot%, PHP5 in the following order to find php.ini:

* Phpinidir (Apache 2 module only)
* Registry key value: Hkey_local_machine-software-phpinifilepath
* Environment variable:%phprc%
* PHP5 directory (for CLI), or Web server directory (for SAPI modules)
* Windows directory (C:\windows or C:\WINNT)
So if it's Apache + PHP5, you can use Phpinidir to specify the PHP5 profile php.ini path.

#以apache的模块方式运行php, all configurations are as follows:

LoadModule Php5_module Modules/php5apache2_2.dll
Phpinidir "d:/php5.4.7"
AddType application/x-httpd-php. php. html

 

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.