Search code examples
phpdocumentationdefaulterror-reportingphp-8

What is the default value for PHP `error_reporting`?


I know what the error_reporting values mean. I know -1 means "show all" and 0 means "show none".

But nowhere is specified what is the value set by default, when nothing is specified by the user.

Trying phpinfo() I see

...
Configuration File (php.ini) Path => /usr/local/etc/php
Loaded Configuration File => (none)
...

So, given there's no php.ini loaded, what is the default value/behaviour of error_reporting?


Solution

  • From the documentation of the config file options

    The default value is E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED. This setting does not show E_NOTICE, E_STRICT and E_DEPRECATED level errors. You may want to show them during development.

    In PHP 8.0, the default changed to E_ALL. See https://php.watch/versions/8.0/error-display-E_ALL