how to set environment variables in apache xampp ?

倖福魔咒の 提交于 2019-12-06 02:56:09

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/37570410/how-to-set-environment-variables-in-apache-xampp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!