Home  >  Article  >  Backend Development  >  How to set time in php.ini

How to set time in php.ini

藏色散人
藏色散人Original
2020-07-03 11:08:403394browse

How to set the time in php.ini: first find and open the "php.ini" file; then search for ";date.timezone="; then remove the preceding semicolon; and finally add the "=" symbol Just add the time zone after it.

How to set time in php.ini

php.ini time setting

date.timezoneSet php5 default date.timezone is utc, changing it to date.timezone = PRC can solve the problem of eight hours difference in time, but I saw it in the official documentation of PHP I haven't found this parameter after a long time.

Although I know that this parameter means "People's Republic of China", there is no such parameter in the official document. There are only Asia/Shanghai, Asia/Hong_Kong and other parameters. Why can it be set to RPC here? Can anyone give me some advice? Where is this parameter? It seems that there is indeed no such parameter in the official documents, I am confused. Generally, it is set to Asia/Shanghai

. I have been using xampp for a while. Today, in order to correct the php acquisition function, it is to obtain the server time.

Since php5.1.0, the date.timezone option has been added to php.ini, which is turned off by default. The displayed time is all Greenwich Mean Time, which is exactly 8 hours different from Beijing time.

Method found online:

Modify the php.ini file, search for ;date.timezone = , and remove the semicolon in front of " =" followed by the time zone.

For example: Asia/Chongqing (Chongqing), Asia/Shanghai (Shanghai), Asia/Urumqi (Urumqi), Asia/Macao (Macao), Asia/Hong_Kong (Hong Kong), Asia/Taipei (Taipei), PRC

Example

;date.timezone =

is changed to:

date.timezone = Asia/Shanghai

The method is very simple. But under xampp, changing the php/php.ini file has no effect. Later, I searched online and found out that damn xampp, put php.ini under apache/bin and modify the php.ini in this to be useful.

Recommended: "PHP Tutorial"

The above is the detailed content of How to set time in php.ini. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn