Re: [PHP] php not reading file properly



Well, if you really want to know, I have to go to many places that do not
have internet access. For those places, I have a PDA. I have Avantgo
software on the PDA, and I wanted it to be able to store a copy of the log
file to review it when I do not have internet access. All I needed was a
webpage to access it, and the Avantgo software automatically downloads a
copy of it before I leave.

On Sun, Aug 24, 2008 at 7:42 PM, Jochem Maas <jochem@xxxxxxxxxxxxx> wrote:

sean greenslade schreef:

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.


you fixed the problem, but I have to ask:

why on earth you want to do this?


Very confused,
zootboy





--
Feh.


Relevant Pages

  • Re: [PHP] php not reading file properly
    ... any unnecessary load to my server. ... file to review it when I do not have internet access. ... "This weeks apache log:". ... it displays the logs when I run the php file thru ...
    (php.general)
  • Re: TOPALOV Wins Game # 8
    ... The file is in fact a PGN - not HTML or PHP. ... But as I said before, I can't rename it on the PDA and I believe there are some problems with the web page, which is probably why my browser got confused. ...
    (rec.games.chess.analysis)
  • Re: advice on mobile wanted
    ... scratch. ... I use my phone primarily as a PDA so need a phone that handles ... the usual office files. ... I'd also like "unlimited" internet access. ...
    (uk.telecom.mobile)
  • Re: advice on mobile wanted
    ... I use my phone primarily as a PDA so need a phone that handles ... the usual office files. ... I'd also like "unlimited" internet access. ... texts. ...
    (uk.telecom.mobile)
  • Re: Accessing function file on another domanin
    ... >First, like I said, you are assigning the result of the include to $x ... according to the PHP manual, ... >webserver (ie if it is on the Internet anyone with Internet access) can ... >execute any PHP function they want in your script. ...
    (alt.php)