PHPInfo to a log file

This example will log the output from phpinfo into a text file

<?php
function LogPHPInfo($logfile)
{
ob_start();
phpinfo();
$contents = ob_get_contents();
ob_end_clean();

//open file
$fp = fopen($logfile, "w+");
//copy $contents to file
fwrite($fp, $contents);
fclose($fp);
}

?>

<?
LogPHPInfo("phpinfo.txt");
?>