Take the 2-minute tour ×

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 stackoverflow.com 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: apachefriends.org/en/xampp.html –  Jeffery A Wooden Jan 13 '12 at 15:42
add comment

4 Answers

You need to add the c:\php.exe to your Windows Path variable. http://www.php.net/manual/en/faq.installation.php#faq.installation.addtopath

share|improve this answer
add comment

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
add comment

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
add comment

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: http://www.youtube.com/watch?v=lVcTqkHtNMg

documentation install guide/detail: http://www.a3webtech.com/index.php/xampp.html

share|improve this answer
add comment

Your Answer


