Linux Tips - How to view your Apache server error log in real-time! | ATG Learning

Blog

Linux Tips - How to view your Apache server error log in real-time!


| Friday, Feb 3, 2017

One of the more annoying things about PHP is getting the ""PHP white screen of death,"" whereby you (presumably) forgot to put a semicolon or closing bracket somewhere and so when you go to view your page, all you get is a blank screen...no error message, no information whatsoever. Annoying, right? The good news is that if you're doing your development on an internal web server that you have control over (because you're not doing your development on a production machine that you don't, right?), if you can ssh into the server then you can view the error log in real-time. In many cases, it will reveal errors you may not be able to see on the page itself, and it will rid you of your white screen of death problem-- it will even tell you which line the error is occurring on!

So what do I do?

Use PuTTY or some other ssh client to get into your server. We're assuming error logging has not been administratively disabled, so navigate to /var/log/apache2 and you should see a file called error.log. If you do, type this command:

tail -f error.log

This will show you a static log...until you try refreshing your PHP page. The log should update itself with the error message that's keeping you from getting any work done on the bottom of the window! You can keep this console window open on a second monitor perhaps, then every time you refresh your page you'll see errors instantly appear in the console. With few exceptions, this won't work if you're doing all your development on a web host like GoDaddy or Dreamhost. They have their own methods of error log management that do not necessarily involve ssh access, but if you insist on not doing your development internally then you might check with your host to see what options they have.

Request Information

Please fill out the form below to contact a training consultant directly or call 888-862-3784

Full Name

Company

Location

Email

Phone

Message

Enter the text in the image