Install PHP on Windows Vista

14
March 2, 2009 // Web

Update 8/23/09 Despite all of the hard work getting PHP installed on Windows Vista, I found a pre-configured WAMP stack that works great inVista  Check out Server2Go!  You can even install it right to a thumb drive.

Update 8/14/09 – After finding many limitations in ultimately successful set-up of LAMP on Windows Vista, I caved in and set up a Linux server for under $200.  After all is said and done, this proved to be a much better, and seamless solution to having a local production environment.

These instructions were adapted from a nice tutorial found at iis.net.

Before you begin:

  • I recommend the text editor Notepad++ for editing config files.
  • If you are like me, you may have remnants of unsuccessful PHP/MySQL attempts installed on your Vista machine.  In order to be successful in this installation, you must uninstall any previous installations of PHP, MySQL, XAMPP, WAMP, etc.

Download the latest PHP .zip package for Windows.

Create a folder named php on your c:drive, and extract the zip file there.  The path will be c:/php.

After the files have unzipped, open the c:\php\php.ini-dist file in Notepad++, then hit file, save as, and save a copy of the file to the c:\windows\ folder, naming it php.ini.

Next, you need to install IIS 7 by going to My Computer, “Uninstall or Change a Program,” and then “Turn Windows Features on or off”

Navigate to “Internet Information Services” and enable the Web Management Tool and WWW Services selected below:

After clicking OK, it will take around 5 minutes for all of the components to install.  Then open the IIS Manager by going to Start > Run > C:\windows\system32\inetsrv\inetmgr.exe

Double click on “Handler Mappings”:

Click “Add Script Map”

Now, map *.php to your php5asapi.dll file which you most likely extracted to c:/php.

Click yes to Allow ISAPI extension:

Open up Notepad++ (start > run > notepad++ ).  Create a new blank page and write it it:
<?php
phpinfo();
?>

Then save the file into the c:\inetpub\wwwroot with the name test.php.  Navigate your browser to http://localhost/test.php

If you see the standard PHP info page, then you can take a sign of relief, as PHP is now successfully installed on your Windows Vista machine.  Now it’s time to make a few more tweaks.

Let’s set it so windows knows to default to index.php when visiting a directory via HTTP.  Go back to the IIS Manager: C:\windows\system32\inetsrv\inetmgr.exe

Double click on “Default Document”:

Click “Add.”

Type “index.php” and hit OK.

Now, let’s make a few quick edits to the php.ini file in your C:/Windows directory.  Open up Notepad++ and then open php.in C:/Windows/php.ini .  We need to set the correct extension directory if you ever plan to use an extension like MySQL.  To do that, simply edit the following line (line number may change on future released of php).  Note that when we originally unzipped the PHP files, we saved it to a folder like C:/php.  We have to tell the php.ini file where this folder is in order for the extensions to run properly:

Since we’re in php.ini, we might as well make a few more changes that will help our future installation of MySQL and other applications.  Create a folder in C:/Temp called phpsessions.  Then edit the following line of php.ini so PHP knows where to save your temporary session files:

Finally, we need to enable some necessary extensions in the php.ini file.  To do this, we simply delete the semicolon from the beginning of the following lines:


Ok, final final step.  Go to the folder you originally unzipped PHP to, copy the libmcrypt.dll and libmysql.dll and paste them to your c:/windows directory.  This will be necessary later when we install MySQL.

Your all set for PHP.  Stay tuned.. I will update this page with a link to the Installing MySQL on Windows Vista next.

Update 8/14/09 – After finding many limitations in ultimately successful set-up of LAMP on Windows Vista, I caved in and set up a Linux server for under $200.  After all is said and done, this proved to be a much better, and seamless solution to having a local production environment.

Update 8/23/09 Despite all of the hard work getting PHP installed on Windows Vista, I found a pre-configured WAMP stack that works great inVista  Check out Server2Go!  You can even install it right to a thumb drive.

About the author

Co-founder, Managing Partner, Nutritionix.com

14 Comments

  1. I have 5.2.9, even though it is out dated, and there isn’t a php5isapi.dll. Can anyone help me? Or if not, direct me to an in-dated tutorial?

  2. Thanks very much.

  3. Ganga Bhavani July 2, 2011 at 2:07 am

    thank you for providing the information

  4. at the step of local host php test i got an error isual studio just-in-time debugger.
    it says that an unhandled win32 execption occured in w3wp.exe[4428].
    what should i do for this error????

  5. Ron – It looks like you have not installed the IIS properly. Make sure to step into the folder to select IIS management Console and the ISAPI extensions when you are installing the IIS server like shown in the snapshot.

  6. #8 – It looks like you have not installed the IIS properly. Make sure to step into the folder to select IIS management Console and the ISAPI extensions when you are installing the IIS server like shown in the snapshot.

  7. Hi: Matt Thanks for the informative tutorial. i’m having one problum in the PHP zip I downloaded there is no file named php5isapi.dll. There is a file named php5nsapi.dll, but when I select it tells me “The specified module required by this handler is not in the modules list. If you are adding a script map handler mapping, the isapiModule or the CgiModule must be in the module list.” I got the files from PHP.net and they are the newest.5.3.0 I’m I doing something wrong. Your site is the only place I can find that actually goes step by step. Can you help me. Your the best

  8. Many Thanks! I’m so happy to have found your instructions before trying this on my own. Sure this saved me hours of pain…

  9. Hey thanks….it was very helpful.
    Bt I have one doubt that if we want it to connect it to Ms Access database then what all changes do I have to make in the php.ini file??

  10. simply superb and really helpful . thanks a lot.

  11. hi, Matt,

    you should install vmware instead :)

  12. Thanks a lot Matt for your time and effort in putting together information…

    It was really helpful.. feeding a aby with a tea spoon… great..

  13. Great job on the PHP / vista instructions. Worked first time (after many earlier tries).
    Do you have MySQL instructions yet?

  14. Thanks for the informative tutorial, I was able to instal PHP with your step by step instruction.

    Thank you

Leave a Comment