Windows

Updated:

Setting up the famous triple threat on Windows is by far the easiest of all the OSes. Very kind people have already made compilations of these programs that should work just fine on Windows 7 and up. Note how I did not say XP. That’s because you should not, under any circumstances, still be using Windows XP, as Microsoft has abandoned it, making it a blackhatter’s playground. But heck, I’ve literally seen Windows 2000 still running on client machines at branches of my bank. I trust that all of you aspire to be good admins.

Apache

On your secure and up-to-date version of Windows, visit apachelounge.com, where you will find Apache binaries on their download page. This is the best resource for the latest Apache, currently on the 2.4 branch (that won’t stop you from still running into people who think there’s no Apache past 2.2). Anyway, first you’ll want to install the requisite VC Redistributable package. The VC version will continue to increase it would seem, so be sure to get the latest one. Check with Microsoft’s site to make sure you’re getting the latest one. Next, download their ZIP file with a compiled, working, and modern-day version of Apache. They provide an x86 and x64 version. If you’re planning on using the 64-bit version of PHP, then you will need the x64 version of the web server. Otherwise, just do the 32-bit one.

Installation is straightforward. Unzip the folder wherever you like. A common choice is C:\Apache24. At the root of the ZIP file, there’s a ReadMe.txt that details the last few setup steps.  Don’t forget to add the Apache bin folder to your path. After you’ve done so, go to the command line and say httpd -k install, which installs Apache as a service.

Now you should start the service, which you can do by either the httpd -k start command, starting the service explicitly in the services.msc program, or by entering the command NET START Apache2.4. The httpd program should now be up and running. Before starting the server, I sometimes like to go to a command line and say httpd -t to check for syntax errors in the configuration file. If you see Syntax OK, you’re golden. Otherwise, address any and all errors and warnings, and you should be good to go.

Consider using the ApacheMonitor.exe program to manage httpd. It is in the bin folder. You might also want to copy a shortut to this program into your %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup folder to have it start when you log in.

With httpd installed, you should check out my win-a2enmod PowerShell script for managing sites and configuration.

PHP

Installing PHP on Windows is also very straightforward, and the PHP Group was sincere enough to write their own guide. First, go to PHP’s Windows download page, or the quality analysis page for a newer, less stable version. However, if you want to use Xdebug, and you must like torturing yourself if you don’t install that on a development machine, you need to choose a PHP version listed on Xdebug’s site, which should be any stable release.

Since you are using httpd from Apache Lounge, you will want the Thread Safe version. You should choose either x86 or x64 depending on which VC Redistributable package you have installed.

It is also customary to unzip the PHP Windows binary into C:\PHP. Of course, you’ll want to add that path to your user or system environment PATH variable so you can easily use the PHP CLI and all that.

To make sure Apache connects with PHP, start by reading PHP’s suggestions. The most important thing is to either use the AddHandler or FilesMatch directive to associate the MIME type application/x-httpd-php with files that end in .php. You may also want to use the PHPIniDir directive to let Apache know where php.ini is. Otherwise, it will search a list of common locations, concluding with C:\Windows.

After restarting the httpd service, PHP should be up and running. You can confirm by loading a PHP script that just calls phpinfo(), but if I were you, I’d get php-console, a very lightweight code sample editor for browsers.

MySQL

Finally, you can sit back and relax while an MSI does all the hard work. Go to the MySQL or MariaDB download page and choose the latest stable version for your OS. Download the installer and run it. You will be walked through setup, including the creation of a root user, password, and other suggested security settings. The installer should add the relevant directories to your path so you can use MySQL programs from the command line. Just make sure that the Workbench and Utilities folders are included.

Although you might be accustomed to tools like phpMyAdmin for working with a database via a GUI, here are a few better programs I highly recommend:

What say you?

This site uses Akismet to reduce spam. Learn how your comment data is processed.