Tuesday, March 29, 2011

PHP on Windows Server

So I have spent the past few months working to get a few web servers up and running.  I am finding that the more I can make things available on the web the more information that the users can get access to.  I like how php works and I like programming in it so I am setting up PHP as often as I can.  This is a document on my steps that I have taken to get PHP setup on a Windows 2003 R2 server.  I am also going to include the install of MySQL as well because the two go hand in hand.

First you need to go and download the latest version of PHP from this website.  As of this writing they were on 5.3.6.

While that is downloading, you also need to download the latest version of FastCGI for IIS.  You can get it here.  This is used by PHP for server response.

Start the PHP installer and answer the basic questions.  Make sure to place PHP directly on the C drive.  It works better if there are no spaces in the folder names.  I like to put it right on C:\PHP\.  Select IIS FastCGI as the Web Server Setup.  I also like to make sure that all of the expected extensions are installed and enabled.

When that is installed I like to go to IIS and set the default document to be index.php.  It should have already been added to the list so I just move it up to the top.  Then I create an index.php file in the inetpub folder and put this code inside:

<?php phpinfo(); ?>

Make sure you go to Web Service Extensions in IIS and allow FastCGI Handler.  I also allow Server Side Includes.

Then from any web browser you should be able to browse to your server and see the PHP info presented.  You have now setup PHP on Windows Server 2003.

1 comment: