Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

You can use set_time_limit to adjust the time a script is allowed to run. Alternatively,
you may wish to use connection_status.


<?
function cleanUp()
{
if(connection_timeout())
{
$statusMessage = date("Y-m-d H:i:s");
$statusMessage .= " The script timed out. \n";


//write status to log file
error_log($statusMessage, 3, "status.log");
}
}


//set cleanUp to the shutdown function
register_shutdown_function("cleanUp");


//wait out the max execution time
while(true);


print("Fake task finished.\n");
?>


debugger_off()


The debugger_off function tells PHP to stop sending debugging information to the
remote debugger.


<?
debugger_off();
?>


boolean debugger_on(string host)


Use debugger_on to enable remote debugging. Diagnostic information will be sent to the
specified host using the port set in php.ini, which is 7869 by default. Use of the remote
debugger is discussed in Chapter 22, "Efficiency and Debugging."


<?
debugger_on("127.0.0.1");
?>

Free download pdf