“date(): It is not safe to rely on the system's timezone settings…”

前端 未结 24 2243
予麋鹿
予麋鹿 2020-11-22 11:06

I got this error when I requested to update the PHP version from 5.2.17 to PHP 5.3.21 on the server.

24条回答
  •  时光取名叫无心
    2020-11-22 11:52

    I had this error running php-fpm in a chroot jail. I tried creating etc/php.ini and /usr/share/zoneinfo in the chroot directory, but it just didn't work. I even tried strace-ing the php-fpm daemons to see what file they were missing - nothing jumped out.

    So in case Google brings you here because you get this error when using php-fpm configured for chroot, you can probably fix it by adding this line to /etc/php-fpm.d/www.conf in the ENV section:

    env[TZ] = America/New_York
    

    A php-fpm restart is normally required for it to take effect. Hope this helps somebody out there.

提交回复
热议问题