CodeIgniter Forums
SetEnv in .htaccess file doesn't seem to work with PHP-FPM - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: SetEnv in .htaccess file doesn't seem to work with PHP-FPM (/showthread.php?tid=70304)



SetEnv in .htaccess file doesn't seem to work with PHP-FPM - sneakyimp - 03-22-2018

I'm moving my CodeIgniter project to a new server, which has Apache in event mode with PHP-FPM installed. For some reason, the SetEnv directives in my .htaccess file no longer find their way into PHP:
Code:
SetEnv CI_ENV testing
that CI_ENV value doesn't ever find its way into $_SERVER["CI_ENV"] in php.

Can anyone tell me why this isn't working and what the recommended best practice is for setting this value a php-fpm environment?

This also may apply to CI controllers executed via command line.


RE: SetEnv in .htaccess file doesn't seem to work with PHP-FPM - InsiteFX - 03-22-2018

Make sure that mod_env.s or mod_env.so is enabled in your php.ini and Apache config.

Apache 2.4 needs it enabled. Otherwise it could be a configuration setting in PHP-FPM.


RE: SetEnv in .htaccess file doesn't seem to work with PHP-FPM - sneakyimp - 03-22-2018

(03-22-2018, 12:21 PM)InsiteFX Wrote: Make sure that mod_env.s or mod_env.so is enabled in your php.ini and Apache config.

Apache 2.4 needs it enabled. Otherwise it could be a configuration setting in PHP-FPM.

if i understnd you correctly, mod_env is installed as an apache module:
Code:
$ sudo apachectl -M | grep env
env_module (shared)
setenvif_module (shared)

Apparently other folks have this problem too:
https://forum.codeigniter.com/thread-68103.html