Reputation: 166066
In PHP, errors are logged to a file specified in the
error_log
php.ini
key. However, if error_log
is not set, PHP will pass this error onto the web server application (Apache, nginx, etc.), which usually results in the error being logged to the web server's error log.
Is there a way, from PHP, to see/fetch/divine the web server's error log for the current domain? Or do you need to manually parse your webserver's configuration file for this information?
Mainly interested in error created via PHP code, not errors created by server configuration.
Upvotes: 1
Views: 98
Reputation: 43243
It might be possible to do this in theory, but in practice it's not feasible due to several factors:
So trying to find and parse the actual webserver error log is probably not something that could be done with reasonable amount of effort.
However, what you could do, is simply use ini_set
from within your script to override the default error log. This way you could just change the error log to your script's directory or such, and parse it from there.
Upvotes: 2