Sunday 6 May 2012

Apache not starting on Windows 7

If you have installed XAMPP on Windows 7 and Apache won't start although no application is using port 80 then uninstall XAMPP and install it again by right-clicking on the XAMPP executable and selecting Run as adimistrator. You'll have to unblock Apache, but Windows should give you that option in the process of installing XAMPP.

To check if any application is using port 80, run from the command line


C:\>netstat -o -a -n

-o   Displays the process id of active connections
-a   Displays all active connections and the TCP and UDP ports on which the computer is listening
-n   Displays active TCP connections, however, addresses and port numbers are expressed numerically and no attempt is made to determine names

and look for 0.0.0.0:80. You'll have something similar to:

Active Connections

  Proto     Local Address          Foreign Address           State                PID
  TCP         0.0.0.0:80                 0.0.0.0:0              LISTENING         2584
  TCP         0.0.0.0:135               0.0.0.0:0              LISTENING         804
  TCP         0.0.0.0:443               0.0.0.0:0              LISTENING         408
  TCP         0.0.0.0:445               0.0.0.0:0              LISTENING           4

For me, the application that is using port 80 has PID 408. You can use PID to track down which application is it. To find out which application has a specific process id, open the Task Manager by using the CTRL+ALT+DEL keyboard combination and click on the Processes tab. In my case is the Apache HTTP server that has the 2584 process ID:



If the PID column does not show up, you can view it by going to View-> Select Columns in the window menu. Clicking on the PID tab will sort the PID entries.

Also as a quick note, Skype might use port 80 and 443 (SSL). In order to make Skype use other ports, open Skype and go to Tools -> Options.. -> Advanced -> Connection and deselect "Use port 80 and 443 as alternatives for incoming connections"

No comments:

Post a Comment