Installing PHP on Windows Using the Web Platform Installer 2.0 Beta

Yesterday, I showed you how to install MySQL Server 5.1 (Community Edition) onto your Windows-based development machine. The reason I wrote the article was to help you prep your machine for installing PHP and PHP-based applications using Microsoft’s Web Platform Installer .

What is Web Platform Installer?

Web Platform Installer is, as the website puts it, “a free tool that makes it simple to download, install and keep up-to-date with the latest components of the Microsoft Web Platform”. Yes, this is stuff you can do yourself, but I’m all for tools that automate away drudgery.

As of this writing, there are two versions of Web Platform Installer available: the original 1.0 version and the beta 2.0 version. In this article, I’m going to focus on the 2.0 version.

Here’s what you’ll see when you fire up the Web Platform Installer 2.0 beta:

wpi_01

Web Platform Installer has three tabs:

  1. What’s New?: This lists the newest applications that are available for download and aren’t already installed on your system. This is the tab that is automatically selected when you launch Web Platform Installer.
  2. Web Platform: This lists web platform applications that are available for download and whether they’re installed on your system. These apps are divided into the following categories:
    • Web Server Applications: Extensions for IIS as well as other server software such as the FTP server
    • Frameworks and Runtimes: Both Microsoft and open source frameworks and runtimes, such as .NET Framework and ASP.NET MVC. This is where you’ll find PHP.
    • Database: SQL Server Express and management tools.
    • Tools: Applications for web development, such as Silverlight and Visual Web Developer Express.
  3. Web Applications: This lists web applications that are available for download and whether they’re installed on your system. These apps are divided into the following categories:
    • Blogs: A selection of .NET blogging apps such as BlogEngine.NET and DasBlog, as well as WordPress.
    • Content Management: Applications like DotNetNuke and Acquia Drupal.
    • Galleries: Photo gallery applications.
    • Wiki: Wikis and apps with wiki functionality, such as the PHP-based Acquia Drupal and the ASP.NET-based ScrewTurn Wiki.

Installing PHP

If PHP isn’t on your system, it will appear on the What’s New? tab page. If you click on the “information” icon beside the checkbox item for PHP, you’ll be shown its information page:

wpi_02

You can choose to install PHP by checking PHP’s checkbox in the list of applications or the Click to include in your install button.

You can choose to add other applications to your install. Once you’ve chosen all the apps you want, click the Install button. You’ll be presented with a list of the apps you chose for review, along with any dependencies for those apps:

wpi_04

To start the installation, click the I Accept button, and Web Platform Installer will do its thing:

wpi_05

Taking PHP for a Quick Spin

Let’s write a very quick script to confirm that PHP is up and running:

 <?php

phpinfo();

?>

In case you’re not familiar with PHP’s built-in phpinfo() function, it returns information about your PHP installation, its configuration and its current environment. It’s useful for all sorts of things, not the least of which is checking to see if your PHP installation worked.

Enter the script above using your favourite editor, and save it as test.php into the web root directory, c:/inetpub/wwwroot Note that in order to save to this directory, you’ll need to be running the editor with administrator privileges. Alternately, you can save to another directory and then copy the file to c:/inetpub/wwwroot, giving your administrative approval when prompted by the dialog box.

Then point your browser at https://localhost/test.php -- you should see something that looks like this:

wpi_06

Next Steps

With PHP up and running, you can install PHP-based apps. PHP apps are like old-school ASP apps; installing them is often a matter of moving the files into the webroot directory and perhaps running an install script by typing its URL into your browser.

phpMyAdmin

One app you might want to consider installing is phpMyAdmin, a PHP-based web application for administering MySQL databases. While it’s possible to administer MySQL solely through its command-line interfaces, phpMyAdmin makes it so much easier. I can’t recommend this utility enough.

Cover of "Wicked Cool PHP"

If I had to recommend just one PHP book, it would be No Starch Press’ Wicked Cool PHP . I find No Starch books to be both informative and enjoyable reads, and this book is no exception. If you’ve got at least a little programming experience under your belt. I think that you’ll find this book and its very useful examples, coupled with the online documentation at PHP.net, will serve you very well.

Happy PHPing!