Saturday, November 3, 2012

Apache and Skype: Yet Another Reason to Keep Things (Virtually) Separate

I rarely use my always-on Windows desktop for anything other than office type of stuff, an occasional blog post, and communication. Still, when I am too lazy to boot up another machine (physical or virtual) for a quick test or something like that, I may run some web applications on it.

I guess, today was one of those "lazy" days. So, I started MySQL. No problem. Then, I tried to start Apache 2.2. It showed me the usual
The Apache2.2 service is starting.....
and then, all of a sudden, gave me this error message:
The Apache 2.2 service could not be started.
A service specific error occurred: 1.
More help is available by typing NET HELPMSG 3547.

I have had Apache web server installed on this computer for... well... pretty much forever, and it worked just fine. That was really odd.

"More help" turned out not extremely enlightening (which I kind of expected):
A service specific error occurred: ***.
EXPLANATION
A service specific error occurred.
ACTION
Refer to the Help or documentation for that service to determine the problem.

Oddly enough, Apache error log did not contain anything related to the failure at all.

Windows Event Viewer was a little more helpful.
One error message said:
The Apache service named reported the following error:
>>> (OS 10048)Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0:80
And the next one said:
The Apache service named reported the following error:
>>> no listening sockets available, shutting down .

Ok. I will save you the detailed description of my poking around trying to find the answer and will just tell you what happened.

It turns out that Skype, under Tools - Options - Advanced - Connection, has a check box (I think, although I am not sure, that it is checked by default) that tells Skype to "use ports 80 and 443 as alternatives for incoming connections". I am sure I saw it before, but, I guess, I didn't pay attention. So, if Skype starts when the web server is already running, Skype checks if ports 80 and 443 are free, finds that they aren't, and just uses its default port. If Apache starts while Skype is already running and using those ports, it (the web server) fails.

Obviously, the remedy is very simple: uncheck the "use ports 80 and 443 as alternatives for incoming connections" check box under Tools - Options - Advanced - Connection (in Skype 4.x), restart Skype, and then Apache should start just fine. Easy... when you know where to look...

Lessons to be learned:
  1. Pay attention to configuration options of different applications or else they will bite you later.
  2. Now that virtualization has become ubiquitous, there is no excuse for slapping all your software onto one system. You can have separate virtual machines for specific purposes. When you don't need them, shut them down. As an added bonus, your desktop will run much better without all the extra stuff you don't use on a regular basis.

P.S. This problem is not Apache-specific since all web servers, by default, use port 80 for http and port 443 for https. It means that Skype, with the "use ports 80 and 443 as alternatives for incoming connections" check box ticked, may create problems for any web server.

No comments: