28 Apr

Configure WAMP (Apache) to work on a custom/non default port


While I was guiding a colleague of mine to install a WAMP server on a windows XP machine and faced this small configuration issue which I thought would have a straightforward fix.

Seems that there isn’t, at least not for the situation I had so I found the hard way to do it. And decided to write a post explaining it since there wasn’t a good article anywhere already for doing it.

Situation: Install Apache to work on a non default (non port 80) port since we already have IIS on port 80.

This post here by Matthew Phillips explains how to configure the httpd.conf file to make Apache listen on a custom port (say 8080). (He blasts IIS for follies which I don’t really agree with, that is not really the point in discussion here 🙂 )

But that doesn’t closely solve our problem since we just modified the Apache’s configuration file and that WAMP is still unaware of the change.

Trying to Install the Apache service from WAMP now still gives the error:

 

The next step after that would be to tell WAMP in its scripts to actually test the custom port (8080) and proceed to install apache. That we do in two files in the Scripts directory located in the WAMP install path.

Edit the following files in notepad:

  1. testPort.php
  2. testPortForInstall.php

In the above files, replace 80 with your custom port number (8080). For me, it was present in 3 places in each file. Save and close the files and restart your Wampmanager and try removing/installing the service now and it should work.

However, there still is the option “Test port 80” under the Services menu in Apache and other links that open up Localhost and phpMyAdmin in the browser that still point to port 80.

 This menu option text is populated from the file Wampmanager.ini and which in turn is refreshed from the wampmanager.tpl each time the Wampmanager.exe is started. The menu item captions are populated from the various language files in the lang folder. The actual actions that are performed are in the wampmanager.tpl file. Just update this file to open the correct URL upon clicking Localhost or phpMyAdmin links. Look for the [Menu.Left] section.

To update the captions, you will have to edit the appropriate language file – find the variable name used in the wampmanager.tpl file for the specific item and look for the caption setting for this variable in the language file and change it accordingly.

For ex.: To change the caption of the item “Test port 80”, I checked that wampmanager.tpl uses a variable called w_testPort80 to populate this value. I opened up the lang\english.lang file and looked for this variable name and changed the string caption.

Restart Wampmanager and Voila!

Disclaimer: The changes mentioned in this post are to customize the work environment for a development machine and any such changes on production servers or internet facing servers should be made with more caution. But then that’s a rare situation to run your website on a non 80 port, isn’t it?

I am using WAMP version 2.0.

2 thoughts on “Configure WAMP (Apache) to work on a custom/non default port

Leave a Reply to Jay Cancel reply