Friday, January 11, 2013

Windows 7 IIS 7.5 + PHP 5.4 Install the AUTOMATIC way - using MS Web Platform Installer!

Install PHP 5.4 (5.x) on Windows 7 IIS 7.5 the EASY way!


Microsoft Web Platform Installer for PHP 5.4 / 5.x to the rescue!

I generally develop my websites in Microsoft technologies: ASPX / DotNet C# with SQL-Server databases. But, I do have a few smaller sites I work on that are build using PHP. Since my normal desktop for website development and software development is a Windows 7x64 Pro machine, I use the built-in Internet Information Services (IIS) 7.5 web server for testing my ASPX sites using localhost (127.0.0.1).

Well, what about testing my PHP Hypertext Preprocessor based applications locally on Windows 7 with IIS 7.5?  Thankfully, you can forget all the overly-complex installation instructions that appear all over the web and install PHP 5.4 on IIS 7.5 the SUPER EASY WAY: use Microsoft's very nice "Web Platform Installer 4.0" to do this!  [Update: you can also use Web Platform Installer 5.0 for PHP 7.0 now, and this will work on Windows 10 / IIS 10.  PHP 7.0 can also be then be updated / upgraded to PHP 7.1 using the PHP for Windows downloads at php.net]

PHP 5.4 on IIS 7.5 step-by-step instructions
using Microsoft Web-Platform-Installer 4.0

Here are the basic steps, and I included screen images showing visual feedback you can expect during the process. And, this whole process is only going to take a few minutes (depending on your download speed).

  1. Get the the Microsoft web page for the Web Platform Installer for PHP 5.4 ("WPI").  You will see a large button on that page saying "Install Now"... click it to download a PHP54.exe (small) program that you run to launch the WPI install process. Note: if you already have the MS WPI installed, you should be able to just use that interface directly to add PHP 5.4 -- WPI should be accessible via your start-menu, and you can find it here too: "C:\Program Files\Microsoft\Web Platform Installer\WebPlatformInstaller.exe"

    [Update] as of 2017-Jan: I noticed that Microsoft no longer has the PHP 5.4 Installer at the link location which formerly existed (above), and that in its place you can get Version 5.0 of the Microsoft Web Platform Installer for PHP 7.0 and/or PHP 7.1is now here.  You will probably need to manually enable CGI (in IIS, under WWW Services, App Dev Features). Once you install WPI 5.0, use its Products-search-feature to find all things "PHP", and you should see the newer 7.x PHP WPI options to select; and, if using PHP on IIS with SQL-Server, be sure to install the Microsoft Drivers 4.0 (x64) for PHP v7.0 for SQL Server in IIS for database connectivity.
  2. Run that PHP54.exe program you downloaded.  This will start the platform-installer and proceed with PHP 5.4 on IIS7.5 installation.  The program will download some more content, then present you with this screen:
    PHP 5.4 on IIS 7.5 Microsoft Web Platform Installer 4.0 Screen 1
    Initial Screen once ready.

  3. Next, click the "Options" link to see the following screen, from which I chose "IIS" for the "Which Web Server would you like to use?", since I have Win7x64 Pro with IIS 7.5 running (versus IIS Express 7.5).  Then, click "OK" to go back to the screen shown in step 2, from which I chose to click the "Install" button...
    PHP 5.4 on IIS 7.5 Microsoft Web Platform Installer 4.0 Options
    The IIS / PHP Install Options
  4. You will be presented with the following screen showing what PHP 5.x.x version is going to be installed on your IIS 7.5 setup along with any other supplemental packages for managing PHP on Windows / IIS.  I just went with the defaults and chose "I Accept"...
    PHP 5.4 on IIS 7.5 Microsoft Web Platform Installer 4.0 Prereqs
    Various Prerequisites :  You can opt out of defaults here
  5. The installation for PHP 5.4 on IIS 7.5 will now take place, and when it completes you will see the following screen.
    PHP 5.4 on IIS 7.5 Microsoft Web Platform Installer 4.0 Finish
  6. Now, once you are done, you will see the Web Platform Installer's menu system that will display some very interesting additional packages you may want to install this way!  There are a lot of very useful packages setup for the super-easy / automatic installation process. See the "Products" and "Applications" tabs for a list.  And,  you will notice how your "PHP 5.4.9" (or whatever version you just installed) shows up in the list of products as "Installed" now:
    Microsoft Web Platform Installer 4.0 Products List

    Microsoft Web Platform Installer 4.0 Applications List
  7. Lastly, if you want to see exactly what was installed and see that these WPI-installed products can be removed via the "normal" way (Control Panel, Programs and Features), here is a screen-shot after using the WPI to install PHP 5.4 on Windows IIS 7.5.  I clipped the screen to show only those items that were installed with PHP for Windows via WPI auto-installer:
PHP5.4 in IIS 7.5 MS Windows Control Panel Installed Programs



I hope you find this all useful and see how super-simple it can be to run PHP on Windows 7 / IIS7.5 for local PHP website development on a Microsoft Platform! And, this even installs some SQL-Server 2012 drivers and PHP connectivity to SQL-Server.

Final Note: Web Platform Installer for PHP does not always keep the PHP installer packages as current as you would prefer.  If you need to update to a newer version, or the most recent version, of PHP, i.e., something newer than what is available in the WPI products list like PHP 7.1.x or whatever, there are some rather lengthy notes about one manual approach to do this exist at this website (though, I have not tried them yet).


Continue to read this Software Development and Technology Blog for computer programming articles (including useful free / OSS source-code and algorithms), software development insights, and technology Techniques, How-To's, Fixes, Reviews, and News — focused on Dart Language, SQL Server, Delphi, Nvidia CUDA, VMware, TypeScript, SVG, other technology tips and how-to's, plus my varied political and economic opinions.

3 comments:

Anonymous said...

Nice article! I used a slightly different method though: went directly through an existing "Web Platform Installer" installation, set the IIS version that I was using in the "Options" menu, and then installed PHP.

I would've installed using the horrible manual method if I hadn't read this article though.

Thanks :)

Magic Travel Andrew said...

Thank you so much for this. Primarily for the link to the MS web installer thing.

I've worked exclusively in Linux for years now so having to get PHP installed under Windows was a painful, confusing saga.

This post was very helpful.

noman dudda said...

Thanks!