This article to give your classmates about the Linux PHP time zone setting method in detail, I hope this method will help you.
In the lamp environment, the ideal situation is the Linux PHP MySQL time zone is set consistent, otherwise the program is very prone to some quirks "timing" problem. Suppose you set the time zone to: "Asia/shanghai"
1. Set the time zone for Linux, taking CentOS5.5 as an example:
Cp-f/usr/share/zoneinfo/asia/shanghai/etc/localtime
2. Set the time zone in MySQL
Edit the MySQL configuration file: My.cnf/my.ini, under [Mysqld], add:
Default-time-zone = ' the ' "
In fact, if the time zone for MySQL's OS is set correctly, you can not set the time zone in MySQL, because the time zone of the OS is automatically used when the MySQL service starts.
3. Set the time zone in PHP
In PHP config file php.ini:
1 Date.timezone = "Asia/shanghai"
After Setup, it is a good idea to restart the system.
If it is a purchased web space, there is no permission to configure the time zone in Linux PHP MySQL. That's fine, just set the time zone in the PHP script that corresponds to the OS, because MySQL uses the OS's time zone by default. Assuming that the OS's time zone is ' Asia/shanghai ', use one of the following two statements:
Ini_set (' Date.timezone ', ' Asia/shanghai ');
Date_default_timezone_set (' Asia/shanghai ');
http://www.bkjia.com/PHPjc/628621.html www.bkjia.com true http://www.bkjia.com/PHPjc/628621.html techarticle This article to give your classmates about the Linux PHP time zone setting method in detail, I hope this method will help you. In the lamp environment, the ideal situation is when Linux PHP mysql ...