日期:2014-05-17  浏览次数:20757 次

Windows系统服务只在机器重启后接受环境变量变化
在一台windows机器上装apache+php
重启动机器有限制,所以安装过程中改了环境变量PATH(加上php的路径)。
没有重启。

结果启动后,没办法加载扩展库。
查了半天怎么让 系统刷新环境变量。
但是对于apache来说,还是不能接收到新的环境变量

看到一个英文帖子:
http://serverfault.com/questions/8855/how-do-you-add-a-windows-environment-variable-without-rebooting

"This problems affects ALL SERVICES, even a restarted service will not see new environment variables. "

"A possible solution for services is to run them temporarily as another user (other than LocalSystem, LocalService, NetworkService). For example for Apache service this works without any problems. To change service account open services.msc console, select service, click service properties and on second tab enter logon credentials for a user. Restart the service and it's environment variables should be up to date."

才知道 环境变量改变,对于以LocalSystem账户运行的windows服务器不起作用。

Microsoft网站上对此问题的描述:
http://support.microsoft.com/kb/821761/en-us

最后,还是重启吧。