Writing phpinfo() To File
Published by philipnorton42 on Fri, 07/11/2008 - 10:40The contents of phpinfo() are quite useful, and it is usually the first thing that many developers perform to make sure that PHP is installed. However, printing out the phpinfo() function can lead to a security risk because it displays a lot of information about the server.
Here is how to write the contents of the phpinfo() function to a file.
1 2 3 4 5 6 7 8 | ob_start(); phpinfo(); $info = ob_get_contents(); ob_end_clean(); $fp = fopen("phpinfo.html", "w+"); fwrite($fp, $info); fclose($fp); |
This is an example of output buffering.
Category:
Add new comment