php.ini :
[CLI Server]
; Whether the CLI web server uses ANSI color coding in its terminal output.
cli_server.color = On
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone ="PRC"
........................
1.
http://192.168.3.123/index.php
America/Los_Angeles2019-06-10 22:46:57
2.
<?php
echo date_default_timezone_get();
echo date('Y-m-d H:i:s',time());
root@dbmgt:/var/www/html/admin# php index.php
PRC2019-06-11 13:48:13root@dbmgt:/var/www/html/admin#
3,坚决方法1 :date_default_timezone_set() (在php脚本入口使用此函数设置市区)
根本原因:命令行执行的php脚本和web端法访问执行的php脚本所调用的php不一样,web端反问的是apache的php扩展,其和命令行方式访问的配置不相同,php.ini 没修改正确,正确的应该配置一般通过web调用phpinfo() 去看