Skip to content
Advertisement

how to set environment variables in apache xampp ?

I would like to add some environment variables in apache xampp in windows. I already tried the following : adding this in httpd.conf

SetEnv ENVIRONMENT "setting"

or, run this script

putenv("ENVIRONMENT='setting'");

but that doesn’t seem to work when I echo phpinfo(), there isn’t ENVIRONMENT variable in the environment section

Advertisement

Answer

I know this is an old post and the OP already may has solved this by himself but for others:

SetEnv ENVIRONMENT setting

This would be the correct Syntax inside of the httpd.conf file. Also, this code should be put at the end of the file.

After saving httpd.conf the apache server needs to be restarted. Otherwise the environment variable will not be set in “this” apache session!

Sincerely, Kami Yang

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement