Three ways to fix a PHP time zone

Source: Internet
Author: User

There is no need to configure the time zone for versions prior to PHP5.2.4. Here are three ways to fix the PHP time zone, for reference only, you can learn the PHP advanced Practical Tips tutorial.

1, fix php.ini this file
Find Date.timezone This line, remove the first side of the semicolon, changed to:

Date.timezone = Asia/shanghai

2. Fix. htaccess file
There are two ways to fix. htaccess files, and the following two statements require only one

Php_value Date.timezone Asia/shanghai
SETENV TZ Asia/shanghai

3. Fix PHP code
Also the following two statements only one sentence can be

Date_default_timezone_set (' Asia/shanghai ');
ini_set (' Date.timezone ', ' Asia/shanghai ');

For Example:

The above is a personal summary and in the online acquisition correction method, you can login e Mentor Network Learning Programming Language Tutorials .


This article is from the "Add Language" blog, please make sure to keep this source http://yuguotianqing.blog.51cto.com/9292883/1554447

Three ways to fix a PHP time zone

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.