PHP and Environment Variables

jgbishop

Senior member
May 29, 2003
521
0
0
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?
 

jgbishop

Senior member
May 29, 2003
521
0
0
Ah. It now looks like this is an IIS issue. Apparently, IIS only picks up variable changes with a reboot. Sheesh.
 

Drakkon

Diamond Member
Aug 14, 2001
8,401
1
0
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 ;)
 

juiio

Golden Member
Feb 28, 2000
1,433
4
81
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.
 

jgbishop

Senior member
May 29, 2003
521
0
0
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. :D