Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 been trying to install PHP on a computer running Windows Server 2008 R2. I have had some success, because I can write scripts and run them from the folder c:\php.

The trouble is, I cannot run scripts from any other folders, and I need to do this.

share|improve this question

migrated from Jan 13 '12 at 21:40

This question came from our site for professional and enthusiast programmers.

Your question doesn't contain enough information for us to help. What web server are you using? What do you mean by "run scripts"? Are you talking about from the command line? What steps have you taken to try and solve your issue? – Jeremy Kendall Jan 13 '12 at 15:01
I am using Windows Server 2008 R2. It is running IIS 7.0 software. By "run scripts", I mean running scripts from the command line. (Also, I want people to be able to access the scripts remotely, by making an HTTP request.) I have followed the exact instructions from the PHP website, but it does not seem to have worked. – user947185 Jan 13 '12 at 15:03
There are limitations when running php on a Windows server. I've been running php on Windows servers for years, your best bet is to use something like xampp: – Jeffery A Wooden Jan 13 '12 at 15:42

Use XAMPP (Apache-MySQL-PHP-Perl) for Windows. Ive been using this for a few years and have been running Moodle on top of it. Has good documentation and wide community support.

Tutorials for setup:

documentation install guide/detail:

share|improve this answer

If you need to run PHP scripts (from the command line) from a directory other than C:/PHP you need to add the path containing php.exe (which is probably C:/PHP) to your PATH environment variable. You can then use php yourscript.php on the command line anywhere you like - just be wary that relative paths for require()'s and such won't work unless you're in the right place.

To have your scripts be served by your web server from different directories, you will need to configure your web server by creating a virtual directory. You'll need to refer to the documentation of your web server here, since you don't mention what it is.

share|improve this answer

You need to add the c:\php.exe to your Windows Path variable.

share|improve this answer

Use the Web Platform Installer from Microsoft. In the list it provides you will fine the latest version of PHP. The installer will perform the installation for you properly.

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.