• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

PHP and Environment Variables

jgbishop

Senior member
I am fairly new to PHP, so I may be missing something obvious here...

I'm working with a Windows PHP install, and I have added some needed paths to my system PATH variable. However, PHP cannot see the updated variable's value! I was logged in as administrator when I set the environment variables, stopped IIS, restarted it, but got nothing. What am I doing wrong?
 
Ah. It now looks like this is an IIS issue. Apparently, IIS only picks up variable changes with a reboot. Sheesh.
 
you can also use the start/stop iis service to get php to update its variables
or instead of running it in ASAPII mode run it in CGI mode...requires a bit more setting up though 😉
 
It isn't an IIS issue, it is just how environment variables on any system usually work. If a process is already running, you have to restart it to get the new enviornment variables.
 
Well, I finally got it working. There were two problems.

1. I had to reboot the machine. Restarting IIS does not update the environment variables. IIS is started as a service (i.e. it's started by services.exe). Since it starts as a service, it inherits all environment variables from its parent (in this case, services.exe).

2. The program installer I used had placed the environment variables I needed in the user section, not the system section. PHP looks at system-wide environment variables, not user-level.

At least I got it working. 😀
 
Back
Top