Portable Development - Apache

Of course, the first part of your AMP instance to get working is the Apache part. A is the first letter of the alphabet, and you need Apache working before you can introduce PHP. And you may as well have AP working before trying to get MySQL working, since MySQL is there for your PHP application to talk to.

The problem I found with Apache was finding a reliable, trustworthy build of Apache for Windows in a non-installer format. I gave up in the end and grabbed the latest stable release of the 2.0.x line for Windows from the Apache downloads site here. You then have to run the installer and install it on a spare windows machine.

Once you have installed it, grab the contents of your install folder (Typically c:\program files\Apache Group\Apache\ or similar) and stick it into a folder on your USB Key. I went for \development\apache containing the contents of my Apache folder.

Once you’ve done this, you need to make some changes to your httpd.conf file. This can be found in the apache\config folder. Edit it in any text editor.

The main complication of using a USB key is that when you stick it in one PC, it will likely have a different drive letter assigned to it when you stick it in another PC. So, we need to make sure all paths are relative.

Now, firepages specifies using \\pdrive\\apache, I found this didn’t work. I used /development/apache/ and this worked fine. In fact, in all places I used Unix style path separators over Windows style path separators. And it all just worked.

In my httpd.conf I specified a number of virtual directories for each application I was working on, I’ll come to them when we first set up a test environment for evaluating software libraries. However, I followed Firepages example and set up a /development/applications/www directory for the server root. In there I maintain an index.html that lists all the things I have to access and works as a start page for me.

The other vital step, is to change the Listen directive to make Apache run on an obscure port. Because the machine you’re using might already have Apache or IIS running on port 80. I usually go for 8080.

Listen 8080

So, once we have Apache copied to our USB key, replaced all the absolute paths with relative Unix style paths to the USB key folders, changed the port Apache will run on and dropped a test index.html into the /development/applications/www folder, we can uninstall Apache from the host machine and leave it clean again.

Now we need to start Apache. I created a temporary start.bat that contained some basic stuff to do this:

/development/apache/bin/apache.exe

Once we run that up, we should have an Apache instance on port 8080. Just point a web browser at it. Congratulations, it’s a little baby portable Apache!

Popularity: 26% [?]

Leave a Reply