Search code examples
phperror-reporting

Why isn't a setting in php.ini not being loaded?


I'm trying to get PHP to display a warning when we call an undefined variable.

php.ini has the line error_reporting = E_ALL | E_STRICT.

The trouble is, strict warning messages are not being output to the browser.

In the PHP script, echoing E_ALL | E_STRICT shows the value 32767.

Yet the value returned by error_reporting() is 22519. I've read online that this value actually matches E_ALL & ~E_NOTICE & ~E_DEPRECATED.

Is the value in my php.ini for error_reporting potentially being overridden? If so, how would I investigate where its value is being set? error_reporting is not being set anywhere in the script. I'm editing the correct php.ini file, as I'm editing /etc/php5/apache2/php.ini which is specified by phpinfo().

Edit

phpinfo() includes the following information:

Loaded Configuration File   /etc/php5/apache2/php.ini

Additional .ini files parsed    /etc/php5/apache2/conf.d/curl.ini, /etc/php5/apache2/conf.d/gd.ini, /etc/php5/apache2/conf.d/mcrypt.ini, /etc/php5/apache2/conf.d/mysql.ini, /etc/php5/apache2/conf.d/mysqli.ini, /etc/php5/apache2/conf.d/pdo.ini, /etc/php5/apache2/conf.d/pdo_mysql.ini 

error_reporting no value (Local)    no value (Master)

Solution

  • The problem was that I had introduced a syntax error into php.ini.

    I presume that the values I mentioned in my question from phpinfo() were PHP's default values that it sets. They were not getting touched, since PHP was not able to load its ini file.

    Thanks to all who responded here helping to debug the issue.