Is there a PHP function or some other way of obtaining the PHP error log as a string?
I need this because I cannot access the error log of a site I am running on someone else’s server. – He offered to email me the error log but that isn’t exactly convenient.
Is there some way I could output the error log to a php page?
I now realize that viewing the entire server’s error log is not really going to happen for me, however, I know you can do something like this to email a manual
error_log call to yourself:
error_log('A really bad error',3,'[email protected]');
Is it possible to configure a page to email errors to you instead of displaying them?
On a badly secured server, yes. But on most servers there are two users: apache and [ you ]. You don’t have access to the server logs, since they are owned by the apache user (or whichever server you’re using).
However, you could probably try it:
Note: that’s the default location on a RedHat-based apache server. It may be different
Update To reflect the updated question
No, you cannot view the error log with
error_log – it is a one-way process that gets handled by the webserver. It only writes the log, but you cannot read it.
You can probably display the errors with this:
ini_set('display_errors', 'On'); error_reporting(E_ALL);
You could even use
set_error_handler to handle all warnings and notices (for example, to mail them). But that’s pretty much all you can do.