Monitor your "error_log" while you work Print

  • 6

The error_log in the apache environment can be the ultimate tool for watching what is happening within a production environment where errors are often supressed.  When you find yourself actively debugging a script, you may want to watch the tail end of the error log for changes.  From the linux shell this is easy with the "tail" function, and with a quick snippet of code you can turn that into a php script for monitoring the error log in your browser.

Create a php file containing the following code.  Update the system command if you are placing the script in a different folder than where the error_log is located.  Change the "20" to any number to represent the lines you wish to display.

<html><head><meta http-equiv="refresh" content="5"></head><body>
<pre><?php

system('tail error_log');



Was this answer helpful?

« Back