开发者

PHP-FPM doesn't write on the log

I have this 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_ti开发者_运维技巧meout   = 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

I don't understand why /home/vhosts/example.com/log/php-error.log is empty, I caused some errors like 10 / 0 (Zero division) etc etc, I see the error as output but the php-error.log still empty.

I chrooted my vhost, but If i change

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

to

/log/php-error.log

I get a really strange error, when I do "10 / 0"!

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


From Debian's documentation:

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.

So you need to copy /etc/localtime file and /usr/share/zoneinfo directory to your chroot directory.


You're not seeing the log entries because the log path you're specifying is the 'real path':

php_admin_value[error_log]          = /home/vhosts/example.com/log/php-error.log

Because you are chrooting you need to specify the 'chroot relative path':

php_admin_value[error_log]          = /log/php-error.log

This is because for the php-fpm worker /home/vhosts/example.com/ is really / due to the chrooting.

I haven't tested it but I suspect your session path might also be subject to this as well, so you'll need to make sure "chrooted /tmp" exists (really /home/vhosts/example.com/tmp) and is writable by the user you're using for that php-fpm pool.


I'm currently having similar issues that could be related to the listen.backlog setting. I've been finding different posts claiming that -1 can be wrongly interpreted. I'm currently experimenting with setting listen.backlog to 0 or a high value. I'll see what the outcome is and keep you posted.

Have you tried correcting the log path as follows? log/php-error.log (the leading slash makes it look for the /log folder which usually doesn't exist on a Linux system.

Kind regards

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜