Error reporting disappeared in PHP5 when using error_reporting “E_ALL” in VirtualHost

It has been my understanding, since a few years back, that setting

php_admin_value error_reporting “E_ALL”

inside my Apache’s VirtualHost configuration actually permitted to set the error reporting to all types of error.

Recently, upgrading Ubuntu from 8.04 to 8.10 (I don’t know exactly which versions of PHP5 that actually meant), several of our team have seen their error reporting disappear…

I first thought this was related to XDebug, installed on all our computers, but disabling it didn’t fix anything.

After 2 hours of searching for pretty much any topic related to this, we (Daniel, Marco and I) decided to search for “php_admin_value” and related error reporting discussions, and found a post somewhere stating that Apache didn’t know of PHP’s constants when inside the VirtualHost, so we couldn’t use E_ALL nor “E_ALL” (which is a string) as PHP needed the *value* of the constant. The suggest value was something like 2047, but looking at the error_reporting syntax on the PHP website, we discovered that E_ALL is actually equivalent to 6143… Who would have guessed…

Well, believe it or not, for a problem that lasted more than a week preventing us to properly develop our code at full speed, this little change fixed the whole stuff.

So if you are going to use php_admin_value to set your error reporting to report all errors, we recommend you do it the right way from the beginning:

php_admin_value error_reporting 6143

This is such a tricky life…

Related Posts

phpUnderControl, PHP_CodeSniffer and PHPUnit

Just a quick link to a few sites that I want to remember...

Adding repetitive events to a simple PHP agenda system

Introduction To prepare for RC1, I have to submit the latest database changes...

Quick Contact Form