3D Ohio Logo

Installing PHP5 on IIS7 Vista 64

This method works, but I suggest that you try: FAST CGI LINK

After spending some time trying to get PHP to work on my Vista 64bit computer, I searched the net. There are many good examples of how to set up PHP from David Wang and Bill Staples, with very thorough instructions. But these didn’t work for me and from the comments on their blogs, it doesn’t work for a lot of people. Mostly with the Error Code: 0×80070032 problem that I had. I finally figured it out, and here’s my step by step to install PHP 5 on IIS7. Which is identical to their method, except a couple of steps. Forgive me if a solution has been posted elsewhere.

  1. Setup / Install IIS7 – README
  2. Make a PHP directory on your computer (I used “C:\PHP“)
  3. Download PHP from http://php.net
  4. Unzip the download to the newly created PHP directory
  5. Copy C:\php\php.ini-dist file to C:\windows\php.ini
  6. Open a command prompt window as administrator! – very important to right-click and Run as administrator
  7. Run the Internet Information Services (IIS) Manager from C:\Windows\System32\inetsrv\InetMgr.exe
  8. Open the Handler Mappings icon from the IIS Area
  9. Click on “Add Script Map…” on the Actions Menu on the upper right
  10. In the Add Script Map dialog:
    • Reqest path: “*.PHP
    • Executable: “C:\php\php5isapi.dll
    • Name: “PHP
  11. Select “OK” and “Yes” to the Add Script Map dialog
  12. Close the Internet Information Services (IIS) Manager and return to the command prompt
  13. Change your directory to: “C:\Inetpub\AdminScripts
  14. Run the following: “cscript.exe adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 true
  15. If you received an Permision denied error (ErrNumber: 70), then you didn’t run as Administrator

  16. Change your directory to: “C:\inetpub\wwwroot
  17. Make a index.php file:
  18. <html>
    <head>
        <title>PHP Information</title>
    </head>
    <body>
        <?php phpInfo(); ?>
    </body>
    </html>
  19. Open your browser of choice to: “http://localhost/index.php

That’s it! You’re done! You may want to add “index.php” to your Default Documents in Internet Information Services (IIS) Manager.

22 Responses to “Installing PHP5 on IIS7 Vista 64”

Mike Volodarsky Says:

Hi Dan,

Thanks for posting this.

I am not sure if you’ve heard about the new FastCGI support for IIS, which is the long-term recommended way to run PHP applications on IIS, instead of the ISAPI which has thread safety issues due to non-thread-safe nature of many PHP extensions.

Windows Server 2008 Beta3+ already comes with this support, but for Vista you would need to use the downloadable technical preview. You can learn more about this here: LINK

Thanks,

Mike

Dan Andrews Says:

Mike,

Great information! I’ll write a blog entry with my experiences with FastCGI in the future. I totally agree that FastCGI is the best long-term recommended way to run PHP. Although, a developer looking for a development platform will find the above article and method functional.

Thanks,

Dan

Jacq Says:

WOW!!! You ROCK! I’ve been trying to figure this out for a week. Nothing worked until I stumbled on your solution. I was doing everything else the same except the “cscript.exe adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 true“ THAT DID THE TRICK!!! Thank you sooo much! You are so awesome! You have no idea how excited I am to finally be able to proceed! Once again, thanks a million!

Michael Barnett Says:

Chairman of the Board says “Oh and i need that real estate website by friday”… today is tuesday …Network admin says “Oh yea we installed a 64 bit version OS on that server goodluck”….

64 bit php???

hmmm many sets of instructions seem to neglect the 14th step

I got an hour before work If this works Dan I’ll site you as a god amoung men
Thanks.

Sami Says:

Thanks a lot,

I have waiting a long time to make php work on vista

until I found this article

thanks 1000 times

ben Says:

This does not work atall for me,, i have vista32 on my laptop and instaled iis7, php and mysql no problems straight forward…. on my desktop pc i have vista 64 all goes well upto step 14 above… in C:\Intepub there is NO admin scripts !!!! so whats going on ?? needless to say i can’t get php to work on visa 64

Dan Andrews Says:

Ben,

Check the directory in step 13. It isn’t C:\Inetpub Copy and past everything in the quotes. It works for everyone else.

-Dan

Will Says:

I’m sorry, but like Ben I had a problem with everything after step 13, however the trick mentioned within http://forums.iis.net/t/1148411.aspx works just as well, and may be a more suitable option as opposed to going through the long command line option that you’ve opted for.

Dan Andrews Says:

Will,
Thanks for the comment and I’m glad that you found another solution.

Ever see “Beautiful Mind”?

“As you will find in multivariable calculus, there is often … a number of solutions for any given problem.

As I was saying, this problem here will take some of you many months to solve. For others among you, it will take you the term of your natural lives.”

Rob Says:

Well these steps didn’t work for me but what did was checking the MIMI type because if .php isn’t in there with the correct functions then it will always have error 403.3 the way to fix it…

add the mime map .php then when it asks for the function its text/plain and then everything will be all set :D

php64 bit Says:

Installing 64bit php on Vista?
Check this out for installing it under fast CGI

http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-70/

Gerd Schmidt Says:

My biggest ptoblem is that I really don’t know what I’m doing.

I have been running XP with PHP and MySQL with no problems.

I now have a new laptop with Vista ultimate SP1

I followed the instructions and got to step 14 and had a problem.

I found adsutil.vbs in another directory and moved it. I found a directory W3SVC but it doesnt have a directory AppPools.

IIS seems to be working in that it does find LOCALHOST.

Also I would also like to be able to set the default website to my own directory.

Any advice?

Jono Cono Says:

Awesome post. This worked perfectly and was really easy to follow. Thanks so much!

Jonathan Martin Says:

Thank you sooooo much for posting this solution. I spent 5 days doing the same microsoft suggestions in numerous different ways to no avail. I wish your post came up sooner in my searches, I typed in “mimemap php” in google. I already knew that having a 64 bit OS is causing numerous errors with my software but I thought I was doing something wrong with the install or configuration. I even downloaded a 64bit moded version of php but never installed it because every solution I read on the internet , Microsoft included, made no mention of this little problem. Forcing me to think I was the error. Thank you again.

Doc Says:

Works, except on some V64 versions, adsutil.vbs is only installed with IIS when you also install IIS6 components: (check) Internet Information Services –> Web Management Tools –> IIS 6 Management Compatibility –> IIS Management Scripts and Tools. This did the trick!!

See Renesistemic’s 6/10/08 post on http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/830aceb2-4d7a-4fe8-ad55-996a1b8c62cf/

Found with a google on Cannot find script file “C:\inetpub\AdminScripts\adsutil.vbs”

phil Says:

I’ve been trying to get a forum running on my sbs2008 server. I’ve got everything running on XP but could not get PHP running under sbs2008 and the above instruction worked 100% as described and I’m over the moon.

Big thanks

Michael Says:

In step 11 – after I type “OK” and “Yes” I am getting the error:

“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 modules list.”

C:\php\php5isapi.dll is found where it should be and it appears IIS is up and running correctly. Any idea what I am doing wrong?

Rick Burney Says:

I have WIN 7 x64 beta with IIS 7. Did not find the admin scripts you mentioned but did find the setting the script is changing was accessible through the Application Pool control panel. Click on the Set Application Pool Defaults action and under general section there is Enable 32-Bit Applications. Thanks for you help, the error message I was getting wasn’t a real good indicator of the problem.

Dennis O'Hara Says:

I have the same error message as Michael ….

“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 modules list.”

Dan Andrews Says:

Please double check the location of the .DLL, and that you did step 10 correctly.

imtiaz Says:

http://www.microsoft.com/web/gallery/install.aspx?appsxml=www.microsoft.com%2Fweb%2Fwebpi%2F2.0%2FWebProductList.xml%3Bwww.microsoft.com%2Fweb%2Fwebpi%2F2.0%2FWebProductList.xml%3Bwww.microsoft.com%2Fweb%2Fwebpi%2F2.0%2FWebProductList.xml&appid=201%3B202%3B203

A microsoft installer
*Updated Recommendations – Please read the following instructions for running PHP fast and reliably*

The FASTEST and EASIEST way to install PHP on IIS is using Microsoft’s Web Platform installer. It completely automates setting up IIS, FastCGI and the latest version of PHP from the php.net site. To install it, just click this button:

If you don’t have Web PI v2 installed, you will be prompted to install it. Once installed, the tool will launch. You can either navigate to the “Web Platform” tab and select “PHP” under “Framework and Runtimes” customize link, or close your browser, re-open to this blog and click the button again to launch the tool directly into PHP install.

For step-by-step instructions on how to install PHP on IIS6 (Windows 2003) with the new Microsoft FastCGI module, see Configuring FastCGI Extension for IIS 6.0.

For step-by-step instructions on how to install PHP on IIS7 (Windows Vista SP1 and Windows 2008) see, Using FastCGI to Host PHP Applications on IIS 7.0

My original blog post follows below and provides instructions for how to install IIS7 on Vista (RTM) using the ISAPI-based PHP. I strongly recommend you upgrade to Vista SP1, however, and use the Using FastCGI to Host PHP Applications on IIS 7.0 instead.

Here is a step-by-step guide for Vista RTM:

1) Download PHP from http://www.php.net/downloads.php. I get the zip package because I think it is just as easy, and gives me control over setup.

2) Unzip the php…zip file to your drive. I usually unzip it to C:\php

3) Copy the c:\php\php.ini-dist file to c:\windows\php.ini. Tweak it as needed.

4) Install IIS7, making sure you install the ISAPI Extension component (for PHP-ISAPI – which is what I use) or the CGI component (if you prefer CGI) during IIS installation (ISAPI and CGI are *not* installed by default)

5) Open the IIS Manager (C:\windows\system32\inetsrv\inetmgr.exe

6) Click on “Handler Mappings”

(click here for full size image)

7) Click on the “Add Script Map” task on the right (in blue):

(click here for full size image)

8) Fill in the dialog box like this:

9) Pause to enjoy this handy dialog box that I had added late in RC1 just for you, then click “yes”

If you click “Yes” it will automatically register this ISAPI /CGI with the extension restriction list – the feature we added in IIS6 to prevent unauthorized executables from running on the server. This saves time, and considering the fact that you’re adding the scriptmap, it’s a safe bet you want it to run. :)

10) go to your C:\inetpub\wwwroot directory and create a test.php page. You can use the simple

function to test if PHP is working correctly.

Enjoy!

Adddendum: several people have commented below that they are having problems getting PHP sessions to work on IIS7/Vista. Please see this post for more information on the issue.

Another note: PHP users may wish to try out the recently announced FastCGI support from Microsoft for improved reliability and performance. See this post for more information on the announcement, and this post for a demo of the new feature.

Dan Andrews Says:

Thanks for the reply imtiaz! I didn’t try this on Vista 64 yet, can someone confirm that this works? (I can’t since I don’t have a machine with Vista on it anymore – only Ubuntu) At the time of my post – almost 2 years ago, FASTCGI was just starting to become understood by the common folks.

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-Spam Image

Wordpress Feedburner Valid XHTML 1.0 Transitional Valid CSS!
copyright 2007 3D Ohio