The 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.
- $info = ob_get_contents();
- $fp = fopen("phpinfo.html", "w+");
- fwrite($fp, $info);
This is an example of output buffering.
php --infoThat doesn't have any HTML in it :)