php not reading file properly | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
I have this snippet of code that is supposed to read the apache access log
and display it:
<?php
$myFile = "/var/log/httpd/access_log";
$fh = fopen($myFile, 'r');
$theData = fread($fh, filesize($myFile));
fclose($fh);
echo
"This weeks apache log (clears every sunday morning):".
substr($theData,0,2000);
?>
For some reason, it displays the logs when I run the php file thru terminal:
php -f /web/apache.php
but not when I access it thru the web. when I browse to it, it just displays
the static text ("This weeks apache log (clears every sunday morning):"),
not the log text.
Very confused,
zootboy
[Search] [PHP Home] [Free Matchmaking Site] [Apache Users] [PHP on Windows] [Programming PHP] [Kernel Newbies] [PHP Install] [PHP Classes] [Postgresql] [Postgresql PHP] [PHP Books] [PHP for Windows] [Never a Charge Dating] [PHP Databases] [PHP SOAP] [PHP Books]
![]() |