I'm trying to do a SetEnv foo bar
in my virtual hosts file but I can never get it to work properly. I'm on a LAMP stack. I've checked that my mod_env
has been enabled via sudo a2enmod env
and it's enabled fine. Running php -i
will not list $_SERVER['foo']
. I've tried it on my local machine and a production server, still same results. Is there something I'm missing?
I've restarted sudo service apache2 restart
without any warnings, so SetEnv
would be parsed fine I imagine.
php -i won't list this, as php on your server isn't going through apache..
try and write a script:
<?php
phpinfo();
and put this at your virtualhost root directory, and run this file.. you will surely see your environment variable in the info,
If you have php-fpm you should put your env variables inside conf file in pool.d/ folder as this.
[www]
env[ENVIRONMENT] = 'VAR'