您的位置首页百科问答

怎样设置PHP的timezone

怎样设置PHP的timezone

的有关信息介绍如下:

怎样设置PHP的timezone

如果在服务器中不设置timezone,总是会报warning,It is not safe to rely on the system's timezone settings. You arerequiredto use the date.timezone setting or the date_default_timezone_set() function。所以需要配置php.ini

访问phpinfo,找到php.ini的配置路径

Loaded Configuration File: /etc/php.ini

编辑 /etc/php.ini

搜索到 timezone,然后更改成为

date.timezone = Asia/Shanghai

保存

重启apache服务器,访问phpinfo,就会发现warning消失了