WAMP in 20 minutes
This post could also have been titled: “I want my Windows box to work exactly like that Mac dev station over there, and I want it done yesterday” - but that seemed too long for a reasonable post title.
The following is the tersest guide you may ever read on getting a Windows 7 machine set up with Apache and PHP. It cheats a little bit, too, in that the ‘M’ from ‘WAMP’ is not the traditional local MySQL server, but a remote MSSQL server that is assumed to be already configured. This introduces one extra component - the Microsoft SQL Server Driver for PHP - that wouldn’t otherwise be part of this guide, but reduces overall complexity quite a bit by removing the SQL server entirely. If you need a guide for setting up a local MySQL or MSSQL server, this post is not for you.
First things first: install Apache. Grab the latest 2.2 build of httpd (2.2.15 at time of writing) from the download page. I used the SSL variant (package name
httpd-2.2.15-win32-x86-openssl-0.9.8m-r2.msi). Install it, keeping all the default options - it should detect your hostname automatically. Start the daemon right away. If you have trouble getting it to bind to port 80, check that IIS is not running. Also check SQL Reporting and Integration services - those require port 80 as well, apparently.
Once that’s started and you can access the “It works!” page that comes standard with Apache through
localhost:80, go get the PHP installer for Windows from their downloads page. Be sure to get the VC6 x86 Thread-Safe package - anything else won’t have the right .dll to deal with Apache on Windows (package name
php-5.3.2-Win32-VC6-x86.msi for PHP 5.3.2 at time of writing). Install it, keeping all the defaults. Add the following snippet to your
LoadModule php5_module "C:\Program Files (x86)\PHP\php5apache2_2.dll" AddHandler application/x-httpd-php .php PHPIniDir "C:\Program Files (x86)\PHP"
Restart Apache and try a traditional
phpinfo() page - you should see the PHP configuration info for your installation.
Once that’s working, go find the SQL Server Driver for PHP from Microsoft (or go directly to the download page). The package is a self-extracting executable that will deliver you a couple help files, a license, and several .dlls. Take the file called
php_sqlsrv_53_ts_vc6.dll and move it to
C:\Program Files (x86)\PHP\ext, then add the following to your
Relaunch Apache once more, check your
phpinfo page, and search for the term “sqlsrv”. If you come up with several hits for the
sqlsrv extension section, you’re done. Enjoy.