Pitfall: php_admin_flag vs. php_flag

Today I was almost going crazy about the PHP ini setting “display_errors”, which just couldn’t be convinced to be “On”. After some searching on the Internet without a result (“Must be an undiscovered bug … dammit”) I was about to give up. Hey, what do we have an error log for? But then good-old intuition stroke again – how about the vhost configuration?

Bingo:

php_admin_flag display_errors off

Who the f…? Well, me of course! I copied a bunch of these statements when taking another vhost configuration file as template, without having a closer look.

“php_admin_flag” is surely nice for hosters etc., because it sets the PHP ini value once and for all. That’s probably tricky, because ini_set() will simply return false, with no more information.

Note to myself: if setting ini values via vhost is really needed, better use “php_flag” instead. This way the value can still be overwritten.

Leave a Reply

Your email address will not be published. Required fields are marked *