* This post gets 100′s of hits a week – if you’ve found this article helpful please leave a comment – thanks in advance!*
* UPDATED FOR XAMPP 1.7.5 (November 2011)
If you have IIS installed on your Windows environment and want to run XAMPP (the windows flavour of Apache, MySQL, Perl and PHP) then here’s an easy way for both applications to co-exist.
There are two ways to solve this – either change IIS (the harder way) or change the Apache config (the easier way) – either way you’ll achieve the same thing. Personally I went the Apache route and here’s how I did it (using XAMPP v1.7.1).
(This assumes you just installed XAMPP)
Change the Port Defaults
By default IIS uses ports 80 and 443 for HTTP and HTTPS access respectively (list of ports and what they do here). By default, Apache also assumes these same settings (as does XAMPP). By altering two config files in apache you can easily over-ride this:
For the purpose of this article I’ll assume you installed XAMPP to the default location.
- Edit file C:\xampp\apache\conf\httpd.conf
- Change line 63 to :
- Listen *:81
- this tells Apache to listen to all IP addresses on port 81 (you probably don’t need the asterisk but I did. You could also change to another port of choice, e.g. 8080) if you were also using port 81
- Change line 175 to:
- ServerName localhost:81
- Again – if you chose another port, update witht that. Save the file and close.
- Edit file C:\xampp\apache\conf\extra\httpd-ssl.conf
- Edit line 42 to:
- Listen 442
- This changes the SSL (HTTPS) port to 442 (or again, your port of choice).
That’s it! *** XAMP 1.7.3 changes – see bottom of post
XAMPP reports the wrong values
When you start XAMPP through the console, it will say starting Apache on port 80. This is just a hardcoded status message it displays; the key piece is that you get a “Running” message through the console.
If you have this all running as a service you can just assume it’s going to work – unless you check the console.
Proof of the pudding – testing XAMPP
Go to http://localhost:81
If all’s well you’ll see the XAMPP Logo; if not, check you updated the configs to use ports that are not already in use. You can also see what apache thinks of your install:
Go to Start > Run > type “cmd” > type “cd c:\xampp\apache\bin” > type “httpd“
If Apache has a problem with one of the port configs it will tell you. Otherwise, if you don’t get a response and the window appears to be “hung”, apache IS running!
If you’re still getting stuck, try stopping the “World Web Web Publishing Service” (right click “My Computer” > Manage >Services), try accessing http://localhost:81 – if it works you know that IIS and Apache are still clashing.
Thanks to one of my readers who pointed out that XAMP newer versions need a few extra changes:
“just search for the line: LISTEN and modify all of the 80 values, there are only 3 of them) , the same thing for the /extra/ folder”
More XAMPP Changes!
Thanks to JesusCrawls for this update **Note**: As of 1.7.5 release of XAMPP...there is a MUCH EASIER way to do this. Go to D:\xampp\install (D: is whatever drive you installed it on, usually C: unless you did a USB install like me) Look for the file called "portcheck", it is a windows batch file. Double click it. After the black screen goes away, click the file underneath it, "portcheck", a Configuration setting file. You will now have a list of ports on your machine that you can use for XAMPP! Worst case, type CMD into the windows search on the desktop and put in: netstat -abno This will give you a list of all ports in use, whats using them and a process ID that can be cross-referenced to task manager's PID column. Try ending the processes/services using the port and run XAMPP again.