Home > Backend Development > PHP7 > body text

What should I do if the time zone modification in php7 is invalid?

藏色散人
Release: 2023-02-18 10:28:01
Original
1655 people have browsed it

php7 Solution to invalid time zone modification: 1. Dynamically modify the time zone from the code to obtain the specified time zone; 2. Modify "date.timezone" and its modification content is "; Defines the default timezone used by the date functions; http://php.net/date.timezone date.timezone =PRC".

What should I do if the time zone modification in php7 is invalid?

The operating environment of this tutorial: windows7 system, php7 version, Dell G3 computer.

php7 What should I do if the time zone modification is invalid?

Generally speaking, we usually modify it in two ways

One: Dynamically modify the time zone from the code to obtain the specified time zone

Two: Through php. Modify date.timezone in the [date] section of ini to modify the time zone, remove the semicolon in front

and add the specified time zone after it. I will specify the time zone of the People's Republic of China as an example

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone =PRC
Copy after login

General The situation is these two modification methods

However, the results obtained by the integrated software xampp I used are not ideal at all

It has no effect at all. The only way to dynamically set the time zone is through code. This is very unfriendly to a lazy person like me

I crawled from the Internet and found that through the

in httpd.conf in apache and adding PRC after it, I can permanently modify the time zone through the configuration file. Now, this is taking the PHP version 5 series as an example.

If it is the latest version 7, you only need to modify mod_php5.c to mod_php7.c. The same applies.

Finally save and restart apache.

Create a php file, enter PHP info();, check the time zone through the web page and you will find that it has been successfully modified to PRC

Personal test is valid, if there is any failure to modify the configuration file time zone You might as well try this method

I am the latest version of php7.3.3, and I did not find this configuration option in the httpd.conf configuration

By adding this at the end of the configuration file The configuration code is just as valid! ! !

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of What should I do if the time zone modification in php7 is invalid?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template