Capturing server logs/errors


This tutorial was originally written by @halfer

You may be getting a PHP error, but this application is not showing it to you. doesn’t have a facility to get web server logs already. You can do it yourself though. Ready?

Now, in your / folder, create a file called errors.log

OK, now in the public_html folder, find your .htaccess file and edit it. Add these lines:

php_value error_log ../errors.log
php_flag log_errors On


  • Also, ensure your logs are one level above the public_html dir - it is not good practise to make your error logs public

Then, re-run your script, and your new log file will capture PHP errors, if they are happening.
The log file file be located in the / directory, errors.log file.

No puedo acceder a mi web! AYUDAA HELP! Tengo este error
Gmail Confirmation link in PHP - HTTP error 500
Getting Mailer Error: SMTP connect() failed error while sending email

Incidentally, I wondered if this can be shortened, so the fully-qualified path is omitted. I tried this though, and got nothing:

php_value error_log errors.log

I was hoping it would put it in my home directory or the same directory in which the .htaccess file appears, but it does not seem to write anything. This solution did not work either.

If someone wants to try testing this, they can trigger errors using a simple PHP script:

trigger_error('It all went wrong');

000webhost forum pages sometimes goes blank