I have Fedora 16 with Nginx and PHP-FPM. Everything is working very good. All logs with PHP notices, warnings, errors etc. are in /var/log/php-fpm/www-error.log
.
Is there a way to configure PHP-FPM to write errors in proper log files configured as error logs for Nginx? So I want to log PHP errors per-virtualhost and not in one global file. (like in Apache Httpd and PHP).
The PHP-FPM directive:
catch_workers_output = yes
will cause errors PHP sends to stdout/stderr to be sent back to nginx, and they will be logged.In PHP 5.2.4 and newer, the directive display_errors is no longer a boolean, but will accept 'stderr' as an option. This should cause all of the errors to go back to nginx, and be logged per vhost.
So in your PHP-FPM config:
php_admin_value[display_errors] = 'stderr'
Your other option is the directive:
php_admin_value[error_log] = /var/log/fpm-php.www.log
which is what you are likely using now. the php-fpm.conf supports some variables, like $pool (which for you, will likely return 'www').
If you have more than 1 pool, you can easily log them separately.
From a quick browse through the source code, it looks like $pool is the only such variable though.