Search code examples
phpstrict

PHP 5 disable strict standards error


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

Can anybody help ?


Solution

  • 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.