XAMPP - Port 80 in use by “Unable to open process” with PID 4!
When you try to start Apache Service from XAMPP control panel you may face the problem that this service can't be run because it can't accesses port 80 of the host server (local site). It may be caused by some services or programs such as skype, Internet Information Services (IIS), and SQL Server Reporting Service that also use port 80. The error messages will appears like this :
16:00:47 [Apache ] Problem detected!
16:00:47 [Apache ] Port 80 in use by "Unable to open process" with PID 4!
16:00:47 [Apache ] Apache WILL NOT start without the configured ports free!
16:00:47 [Apache ] You need to uninstall/disable/reconfigure the blocking application
16:00:47 [Apache ] or reconfigure Apache and the Control Panel to listen on a different port
16:00:47 [Apache ] Attempting to start Apache app...
16:00:48 [Apache ] Status change detected: running
16:00:49 [Apache ] Status change detected: stopped
16:00:49 [Apache ] Error: Apache shutdown unexpectedly.
16:00:49 [Apache ] This may be due to a blocked port, missing dependencies,
16:00:49 [Apache ] improper privileges, a crash, or a shutdown by another method.
16:00:49 [Apache ] Press the Logs button to view error logs and check
16:00:49 [Apache ] the Windows Event Viewer for more clues
16:00:49 [Apache ] If you need more help, copy and post this
16:00:49 [Apache ] entire log window on the forums
Or see image below :
Here are some options to solve the problem :
Option 1 : Stop other services directly from XAMPP control panel
On XAMPP control panel click Services button (see image above), a new window with services list will appear (see image below, filename is services.msc, extra info).
OPTION 2 : Change port directly from XAMPP control panel
Another very easy option is to simply set Apache to listen on a different port (see image below). This can be done by clicking on the "Config" button on the same line as the "Apache" module, select the "httpd.conf" file in the dropdown, then change the "Listen 80" line to "Listen 8080". Save the file and close it.
Now it avoids Port 80 and uses Port 8080 instead without issue. The only additional thing you need to do is make sure to put localhost:8080 in the browser so the browser knows to look on Port 8080. Otherwise it defaults to Port 80 and won't find your local site. This will also require you to restart Apache for the change to take effect.
OPTION 3 : Stop other services by using command prompt or from the programs itself
- Skype: skype uses port 80/443 by default. You can change this from tools->options-> advanced->connections and disable checkbox "use port 80 and 443 for addtional incoming connections".
- IIS: IIS uses port 80 by default so you need to shut down it. You can use the following two commands 'net stop w3svc' and 'net stop iisadmin'
- SQL Server Reporting Service: You need to stop this service because it may take port 80 if IIS is not running. Go to local services and stop it.