php suppress errors
Posted 30 March, 2009 in Other Stuff
When you have your PHP script up and running on the web, you might want to suppress any errors as they can show visitors some of the inner workings of your scripts.
Here are three basic levels of error suppresson or lack of it:
error_reporting(0); // Suppress all errors
ini_set (“display_errors”, “1″); // Suppress all but fatal errors
error_reporting(E_ALL); // Show all errors. Good for debugging
For more on this see:
http://uk.php.net/error_reporting
Also you can put an at “@” before any function to suppress errors it might generate.
PHP change max execution time
Posted 30 March, 2009 in Other Stuff
Having trouble with your PHP scripts timing out? You need to change the max execution time. Try one or both of the following:
ini_set(“max_execution_time”, 60); // Set to 60 seconds
set_time_limit(60); // Set to 60 seconds
For no time limit try:
set_time_limit(0); // No time limit
You might still run into problems of your server is running PHP in safe mode. Also your server will have a timout that might need to be changed.
If you have access to php.ini then try changing max_execution_time to a higher value. This will however effect all your PHP scripts.




