I was wondering if there's a way to use an Environment Variables (or similar) with an if statement in order to turn certain things on and off, such as display_errors, modpagespeed.
So for example:
SetEnv DISPLAY_ERRORS on
<If "DISPLAY_ERRORS == on">
php_flag display_errors on
</If>
<If "DISPLAY_ERRORS == off">
php_flag display_errors off
</If>
I've spent quite a while searching for such a thing but I was unable to uncover anything which does this. Is this even possible?
I'm looking for an easy way to edit the htaccess using PHP, but instead of writing blocks to htaccess it would be easier to just change the "on" and "off" values and would also make it easier to display this as radio buttons within my application.
We can be tempted to write this:
But it seems that
<If>
is evalued before anySetEnv(If)
.A different working approach I have in mind would be:
And starting Apache with a
-DDISPLAY_ERRORS
argument to display errors or, for Apache >= 2.4, add aDefine DISPLAY_ERRORS
in the virtualhost configuration.