PHP-FPM 不写入日志

标签 php

我有这个 php-fpm.conf

[example.com]
        listen                 = 127.0.0.1:9001
        listen.owner           = example.com
        listen.group           = example.com
        listen.mode            = 0660
        listen.backlog         = -1

        user  = example.com
        group = example.com

        pm                   = dynamic
        pm.max_requests      = 0
        pm.max_children      = 2
        pm.start_servers     = 1
        pm.min_spare_servers = 1
        pm.max_spare_servers = 1

        chroot = /home/vhosts/example.com/

        request_terminate_timeout = 2
        request_slowlog_timeout   = 1
        slowlog                   = /home/vhosts/example.com/log/php-slow.log

        catch_workers_output = yes

        env[HOSTNAME] = $HOSTNAME
        env[PATH] = /usr/local/bin:/usr/bin:/bin
        env[TMP] = /tmp
        env[TMPDIR] = /tmp
        env[TEMP] = /tmp


        php_flag[display_errors]            = on
        php_admin_value[session.save_path]  = /tmp
        php_admin_value[error_log]          = /home/vhosts/example.com/log/php-error.log
        php_admin_flag[log_errors]          = on
        php_admin_value[memory_limit]       = 100M
        php_value[max_execution_time]       = 20

我不明白为什么/home/vhosts/example.com/log/php-error.log 是空的,我导致了一些错误,例如 10/0(零除法)等,我看到错误作为输出,但是php-error.log 仍然为空。

我chroot了我的虚拟主机,但是如果我改变了

/home/vhosts/example.com/log/php-error.log

/log/php-error.log

当我执行“10/0”时,我收到一个非常奇怪的错误!

Fatal error: main(): Timezone database is corrupt - this should *never* happen! in /web/index.php on line 10 

最佳答案

来自 Debian 的文档:

Timezone data from system timezone database

Debian PHP has been patched to use of the system wide timezone database from the tzdata package, making sure any updates there are automatically used by PHP aswell.

Note that this requires that the PHP process has access to /etc/localtime and /usr/share/zoneinfo. For any regular installation this should be the case, but in specific secured environments when reading the timezone database is impossible PHP will give a "Timezone database is corrupt - this should never happen!" error.

因此您需要将/etc/localtime 文件和/usr/share/zoneinfo 目录复制到您的 chroot 目录。

关于PHP-FPM 不写入日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5862453/

相关文章:

php - 加入mySQL查询,两个列名相同,如何显示数据?

java - PHP 和 AlertDialog 在 Android 上不同步

php - 使用 Zend Framework 为 PDF 添加水印(在文本层下添加一些东西)

php - CakePHP/PHP,克罗地亚日期转换为mysql日期

php - mysql select where left join语法

php - strtotime 对于遥远 future 的日期的奇怪行为

php - mysql 和 codeigniter 更新多行

php - 有点简单的PHP数组求交问题

php - MySQL - 显示计数结果

php - openssl_decrypt 标签值