`PHP致命错误:date():redhat 6.9,nginx,php-fpm上的时区数据库已损坏

时间:2017-08-11 07:53:58

标签: php nginx timezone redhat

我在php-fpm上调用date()时遇到错误。

我知道php-fpm适用于phpinfo()操作。

我已向/usr/share/zoneinfo/etc/localtime授予了777的许可。但仍然无法正常工作。

这是我的源代码和environemnt。

# time.php
<?php
    echo date('r');
?>

# php-fpm error log
[11-Aug-2017 16:18:41] WARNING: [pool www] child 64492 said into stderr: "NOTICE: PHP message: PHP Fatal error:  strftime(): Timezone database is corrupt - this should *never* happen! in ******time.php in line 2"

# current environment
[root@localhost ~]# lsb_release -a
LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description:    Red Hat Enterprise Linux Server release 6.9 (Santiago)
Release:        6.9
Codename:       Santiago
[root@localhost  ~]# nginx -v
nginx version: nginx/1.12.0
[root@localhost  ~]# php -v
PHP 5.3.3 (cli) (built: Nov  7 2016 11:21:30)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

2 个答案:

答案 0 :(得分:0)

尝试重新安装系统时区数据库'stuff' -

yum reinstall tzdata

答案 1 :(得分:0)

Reinstalling timezonedb with pecl解决了我的问题。