PHP 8.0: PHP Startup Errors are displayed by default

Version8.0
TypeChange

PHP Startup Errors are emitted when PHP parses the INI files and starts up. These errors are different from standard application errors and their visibility is toggled with display_startup_errors INI directive. .

INI setting display_startup_errors controls whether the startup errors should be displayed.

Prior to PHP 8.0, the INI directive was set to Off, potentially hiding useful information. This value is set to On by default in PHP 8.0.

- display_startup_errors=Off
+ display_startup_errors=On

session.name = ""

The INI setting above is invalid, because the session.name must be a non-empty non-numeric string. PHP emits a startup warning if it encounters such value:

# php -d session.name="" test.php

Warning: PHP Startup: session.name cannot be a numeric or empty '' in Unknown on line 0

A few such potential startup errors include:

  • Missing the module file (extension=foo.so): Warning: PHP Startup: Unable to load dynamic library 'foo.so'
  • Invalid session.name value (session.name=""): Warning: PHP Startup: session.name cannot be a numeric or empty '' in Unknown on line 0
  • Invalid session.upload_progress.freq value (session.upload_progress.freq=101%): Warning: PHP Startup: session.upload_progress.freq must be less than or equal to 100% in Unknown on line 0

Backwards Compatibility Impact

This is a mere default INI value change. It is possible to set this value back to Off in an INI file (more effective) or with a ini_set call (less effective).

display_startup_errors=Off
ini_set('display_startup_errors', 'Off');

Related Changes


Implementation