“phpinfo(): It is not safe to rely on the system's timezone settings…” [duplicate]

前提是你 提交于 2019-12-01 04:11:47

You have 2 options:

  1. Call this function date_default_timezone_set() before using any date functions. E.g. date_default_timezone_set("America/New_York");.

  2. Edit the php.ini file usually located at /usr/local/php/php.ini and change the date.timezone entry. Here is the list of supported timezones.

In my case I had update php.ini in two places. One was /etc/php5/apache2/php.iniand /etc/php5/cli/php.ini. You have to restart your apache and then it should work. Hope this helps!!!

I solved this problem by find which php.ini your server is using. First, you should make a page show phpinfo(), and you visit the page, you can see the normal infomation; Second, find "Loaded Configuration File" in the page, you should see what php.ini file your server is using. like:"/etc/php.ini"; Third, you edit the certain file in your server, like: date.timezone="Asia/Shanghai" then restart the server. Done. Good luck.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!