I'm moving from a prefork apache setup to event mode with php-fpm. In prefork mode, I can use SetEnv directives in an htaccess file like so:
SetEnv CI_ENV testing
And that value ends up in PHP:
echo $_SERVER["CI_ENV"]; // outputs "testing"
However, with apache in event mode, that value no longer gets into PHP. Is something broken? What is the best, most orthodox way to fix this? Should I put a SetEnv command in the VirtualHost directive? In the php-fpm.conf file? Please advise.
S
Best Answer
Everyone should be delighted to know that you can in fact put a SetEnv directive in your VirtualHost in the apache configuration file and this still works, even with PHP-FPM.
In my case, that file is /etc/apache2/sites-available/default-ssl.conf:
Within the
VirtualHost
in there, you can add yourSetEnv
directive: