RE: Capturing phpinfo()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



John Holmes wrote:
>> From: "Ashley M. Kirchner" <ashley@xxxxxxxxxx>
>>     How can I stick phpinfo() at the bottom of a page in such a way
>> that it doesn't display the data in the page, but instead creates a
>> log file and dumps everything in there)  The log file should either
>> be appended to every time, or if not, a unique one created every
>> time (one per transaction.)  Is this even possible?
>
> Of course it's possible. Just fopen() a file at the end of the
> script, capture phpinfo() output with an output buffer (ob_start(),
> etc) and write it to the file. I can imagine the file getting very
> large very quick, though.

Yup...on my test server here the HTML output of phpinfo() is 40Kb.  The text
version is 15Kb.  Depending on how many hits per day a site gets that can
add up fast.

Not only that, but also assuming a web server is involved there could easily
be many concurrent slave processes active.  Therefore if the file's
integrity is to be maintained (assuming a single file) then flock() should
be used.

Alternatively, assuming Apache, one file per request could be created.  If
mod_unique_id is installed/active then $_SERVER['UNIQUE_ID'] will be
available and could be used as the filename, or the basis for the filename.

Of course I'm not sure I see the point of saving phpinfo() for each
request...a large portion of it will be identical for every request.  Those
portions that differ from request to request can be logged more efficiently
in other ways...for example, dumping the contents of $_SERVER.  Of course,
much of that information can be gleaned from the Apache logs...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux