PHP 5 disable strict standards error


Question

I need to setup my PHP script at the top to disable error reporting for strict standards.

Can anybody help ?

1
173
8/8/2009 2:06:47 PM

Accepted Answer

Do you want to disable error reporting, or just prevent the user from seeing it? It’s usually a good idea to log errors, even on a production site.

# in your PHP code:
ini_set('display_errors', '0');     # don't show any errors...
error_reporting(E_ALL | E_STRICT);  # ...but do log them

They will be logged to your standard system log, or use the error_log directive to specify exactly where you want errors to go.

183
12/23/2015 7:18:58 PM

For no errors.

error_reporting(0);

or for just not strict

error_reporting(E_ALL ^ E_STRICT);

and if you ever want to display all errors again, use

error_reporting(-1);


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon