how to set environment variables in apache xampp ?

13,167

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

Share:
13,167
otong
Author by

otong

Sometimes I really don't have an idea of what I'm talking about. Sometimes I just blindly follow what the console outputs.

Updated on June 14, 2022

Comments

  • otong
    otong almost 2 years

    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