Home > Backend Development > PHP Tutorial > How to configure PHP in Azure Websites to change the system default time zone

How to configure PHP in Azure Websites to change the system default time zone

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-08-08 09:29:04
Original
1028 people have browsed it

Azure Website provides us with a highly scalable website deployment platform. Since Website is a PaaS (Platform as a Service) layer service, when users migrate their original PHP websites to Azure Websites, there are some configuration methods that are different from traditional methods. For example, in Azure Websites, we cannot access the server running the PHP engine, nor can we access the php.ini file.

In the running environment provided by Azure websites, the default time zone is UTC time. For customers in China, we often hope to directly obtain the time zone of GMT+8 through the date object. At this time, we need to create a .user.ini file in the root directory of the PHP application and specify in it:

<code><span>date.timezone</span>=<span>Asia/Chongqing</span></code>
Copy after login


Note: After adding the .user.ini file, you need to restart Azure Websites.

In this way, if our PHP source code is as follows:

<code><span><<span>html</span>></span><span><<span>head</span>></span><span><<span>title</span>></span>PHP Demo page<span></<span>title</span>></span><span></<span>head</span>></span><span><<span>body</span>></span><span><span><?php</span><span>echo</span> date(<span>"r"</span>);
    <span>?></span></span><span></<span>body</span>></span><span></<span>html</span>></span></code>
Copy after login

The above code will get the following page output:

Another:
Generally speaking, as long as the configuration information in the php.ini file is not a System-level configuration item, we can modify it in the scope of the application through the .user.ini file. Here (http://php.net/manual/en/ini.list.php) is the configuration item list and effect level of php.ini.

The above introduces how to configure PHP in Azure Websites to change the system default time zone, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template