I recently upgraded my work computer from a Windows 7 system to a Windows 10 64 bit high-performance rig.
As my work primarily involves web-development hence one of the first things I had to set up on my new system was web-server, MySQL database, and the ilk. I have, for years, been using the XAMPP pack for my LAMP stack so that is what I installed on my new system too.
But, to my surprise, when I fired it up for the first time, the Apache server failed to start!
Apache server port 80 blocked by PID 4 on Windows 10 – XAMPP
The first thing I did when I saw this error was to fire-up the Taskmanager and try and stop the process with PID 4. That, however, did not work.
SOLVED – XAMPP Apache Server Port 80 blocked by a process with PID 4
This is how I finally solved the issue and managed to run my Apache server again, on port 80.
First, from under your Start menu, go to run and then type the following and hit Enter.
services.msc
This should bring up the Windows Services Management Console. Here, look for the process with the name World Wide Web Publishing Service.
Find the service with PID 4 in Services.mscYou can stop it by going to the Properties menu item that you get when you right-click on the process.
Now, try starting your Apache server through XAMPP and this time, the server will start running successfully on port 80.
But, the problem will occur again when the computer restarts.
So, in order to stop running this process even after a restart, I had to do a couple of more steps as below:
Along with stopping the process, also select the Disabled option from the Startup type dropdown menu. This will ensure the process does not start again on a system restart, thereby blocking the port 80 which Apache webserver uses to run as that is the default port for HTTP requests.
That’s it!
Bonus tip
Another way of making sure the Apache web server runs successfully, without doing the things I have mentioned above is to edit the httpd.conf file and look for the line where it says Listen 80. The 80 here is the port number which the process with PID blocks.
You can simply change the apache listening port number here from 80 to something else like, 8080 and then save the file.
Then try starting the Apache server and it would run successfully this time!
2 thoughts on “Cannot start Apache server on XAMPP. Port 80 blocked by PID 4!<br/> [SOLVED]”
Thank you Guru ji its working fine
You are welcome Imran. Glad that it worked for you 🙂