Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have got a number of scripts being moved from an Apache server to an IIS server. Many of these scripts assume that the current working directory of the script is the same as the directory containing the primary (?) scipt file being run. On the IIS server this seems to not be the case, with the working directory always being the PHP directory (e.g. C:\PHP).

Is there some way to change this and make IIS or the FastCGI module use the scripts directory?

I also tried putting a "chdir(dirname(__FILE__))" at the start of the scripts, but apperently that idea is not allowed, with chdir("C:\MySite") failing ("No such file or directory (errno 2)") while "C:\" or "C:\MySite\subdir\" seem to work...

share|improve this question

You could try moving the PHP executable into the same directory as the scripts? (It doesn't sound awesome to me, but then I can't think of another solution if it's not possible to specify a working directory otherwise).

If you do that, I think you'll also need to update your Web Service Extensions list to reflect the new location.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.