This isn't working. My Firefox keeps spinning, but nothing comes up. I have verified the path to the log file, and executing the tail command below in a terminal works. There is a tail process showing up on the server after I hit this page though.
/* ensure the script wont time out */
set_time_limit(0);
/* send data after each echo */
ini_set('implicit_flush', 1);
/* watch for canceled request */
ignore_user_abort(false);
/* open a process file pointer */
$pfp = popen('tail -f /Library/WebServer/Logs/www.mydomain.com.error.log', 'r');
/* make sure it worked */
if (! $pfp ) {
die('Can\'t open file');
}
/* continue while the user hasn't aborted or
we've still have a connection */
while (! connection_aborted() ) {
/* get a line and echo the contents
from the file pointer opened */
echo fgets($pfp);
}
/* close the process file pointer */
fclose($pfp);