1

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

2
  • Everyone will be delighted to know that this question has earned me the Tumbleweed badge. Commented Mar 30, 2018 at 15:08
  • Everyone would be delighted to know if this was actually the case - not in htaccess, but you could set it in the virtualhost directive ? Commented Nov 14, 2018 at 20:22

1 Answer 1

0

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:

sudo nano /etc/apache2/sites-available/default-ssl.conf 

Within the VirtualHost in there, you can add your SetEnv directive:

 <VirtualHost _default_:443> ServerAdmin webmaster@localhost DocumentRoot /var/www/html # ETC ETC ETC # added because it doesn't work from .htaccess file with PHP-FPM SetEnv CI_ENV testing # ETC ETC ETC </VirtualHost> 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.