I have a server running Lighttpd with three user's serving domains from it. Each user gets their own PHP FastCGI process for serving PHP content across all of their domains. Lighttpd allows me to write the access log files for each domain to unique log files. I also want to write PHP errors to three different log files (one for each user).
Each PHP process is reading its own php.ini (this has been verified by viewing phpinfo()
output). Each php.ini specifies the log file to which it should write. For example:
error_reporting = E_ALL & ~E_NOTICE
display_errors = 0
log_errors = 1
html_errors = 0
fastcgi.logging = 1
error_log = /var/www/vhosts/example.com/logs/php_errors.log
If I set fastcgi.logging = 1
then the PHP errors, for all three users, always go to Lighttpd's error log. If I set fastcgi.logging = 0
then the PHP errors get written to the system STDERR. In this case, I can redirect the STDERR for each FastCGI process to whatever file I like, but I loose time stamping on the errors (which is less than ideal).
So, how do enable proper error logging for my PHP FastCGI processes through Lighttpd?
Lighttps supports only one error log. But it can be a program!
So try logging to your own script that splits the error log based on your own criteria. The syntax is: