[xampp] XAMPP - Apache could not start - Attempting to start Apache service

While trying to start Apache using XAMPP, I was receiving - "Attempting to start Apache service..." message in XAMPP UI. No further details were available.

Where can I see the logs (I was running XAMPP as Admin) ?

Apache - Fails to start

This question is related to xampp

The answer is


My scenario was different after I tested all the possible options. If you have changed the ports and still get the same problem, well here's something you can try out. This was done in Windows 7.

Step 1: Confirm the cause of the error by going to Control Panel -> System and Security -> Administrative Tools -> Event Viewer -> Windows Logs -> Application -> Error. Mine said "The Apache service named reported the following error:

httpd.exe: Syntax error on line 424 of C:/xampp/apache/conf/httpd.conf: Cannot load c:\xampp\php\php5apache.dll into server: The specified module could not be found." So I needed to change \php5apache.dll to the version of my php and apache version installed which was php7apache2_4.dll

Step 2: To get the correct name for your .dll php and apache file, got to C:\xampp\php. You will see something like php7apache2_4.dll with other files in the folder.

Step 3: Go to C:/xampp/apache/conf/httpd.conf and edit the configuration file and change "c:\xampp\php\php5apache.dll" to "c:\xampp\php\php7apache2_4.dll" in my case. Make sure you open the file as administrator save changes made.

Step 4: Run the xampp server and everything should work fine. Do not forget to shut down the xampp server before doing the changes to the apache configuration file.

Hope this helps. Cheers! :)


I had the same problem but was because I had already previously installed xampp , and I tried to install a newer version , then I installed the newer version in another file directory (I named the file directory xampp2). I solved the problem after uninstall the newer version, rename the old one (I renamed as xamppold), and installing xampp again.

I guess if you didn't installed xampp in another file directory or something like that , it should be enough to reinstall xampp. If you are worried about your files , you always can make a backup before reinstalling xampp.

I solved the problem after watching the xampp activity log (the list of the bottom) and realizing xampp was trying to open the custom file path but I had another route path. If the first option didn't worked, at least you can scroll up in the activity log and see whats the error you get while starting as admin and trying to re install the Apache module or trying to start the module.

You may wander why I didn't just simply uninstall the whole thing from the beginning , and the answer would be I have tweak a couple of things of xampp for some different projects (from changing the ports , to add .dll to run mongo.db in Apache), and I'm just too lazy to re-do everything again :b

I hope my answer can be helpful for anyone since is my first time writing in stackoverflow :)

Cheers


when i run xampp control panel normal:

enter image description here

I had been run

I can’t start apache So, I will run it with administrator:

enter image description here

I can run apache


Solution for my particular scenario (It had been working a couple days before getting borked):

Port 80 was not the problem, but something I had done while messing around with Services and Startup.

  1. Type msconfig on Windows' Start menu
  2. Click System Configuration

Screenshot for System Configuration

  1. In the Services tab, search for Apache24 (Click "Hide all Microsoft services" in the checkbox at the bottom of the window to make it easier to find)
  2. If its checkbox isn't checked, check it

If it was already checked, then this guide isn't going to help. However if it is:

  1. Click OK, your PC will have to restart
  2. Try once again! In my case Apache was already running once I opened Xampp

Also check if your xampp is installed in the main directory like C or D or E and not in or within a folder of that directory? i.e. ( "D:/Xampp" or is it "D:/something/Xampp") if its not in the main path of the directory, it will show this error.

copy your xampp directory from "D:\Something\Xampp" to "D:"
So it becomes like this "D:\Xampp" and the issue will be resolved.


Had the same issue while updating to PHP7.2

Problem: First I closed skype and then checked whether port 80 is not an issue. How you can check that? See @AlexT comment above.

In my case, port 80 wasn't an issue. So now I had to figure out what was wrong. So I checked Error Logs Control Panel > Even viewer > Windows Logs > Application and found following error against Apache2.4

httpd.exe: Syntax error on line 520 of C:/xampp/apache/conf/httpd.conf: Syntax error on line 18 of C:/xampp/apache/conf/extra/httpd-xampp.conf: Cannot load C:/xampp/php/php7ts.dll into server: The Apache service named is not a valid Win32 application.

Which means I had installed wrong PHP version. Actually I downloaded win64 version while the required version was Win32 for me.

So I downloaded correct version from: Download PHP 7.2.0 extracted it in C:/xampp/php folder, restarted the apache and it worked :)


Make sure Apache didn't get Disabled in Services (Control panel, Admin Tools, Services). If it's Disabled then Set it to Manual and it should run. That was my case, I found Apache Disabled.


Check your DocumentRoot path (in httpd.conf); a typo there can cause this problem.


IF PORT 80 IS NOT THE ISSUE!

Check to see if the port 80 is in use first as this can be an issue. You can do this by typing "netstat -an" into cmd. The look for 0.0.0.0:80 under Local Address, if you find this is in use then follow the solution from @Karthik. However, I had a similar issue but my port 80 was not in use. My XAMPP had wrong paths locations, steps to fix this:

1.Find out the Apache version you are using, you can find this by looking in Services (Control panel, Admin Tools, Services) and finding Apache in my case it was listed as Apache2.4

2.Close XAMPP.

3.Run cmd as admin.

4.execute 'sc delete "Apache2.4"' (put your version in place of mine and without the surrounding ' ', but with the " " around Apache).

5.execute 'sc delete "mySQL"', again remove the '' when you type it.

6.reopen XAMPP and try starting Apache

If you are having trouble with FileZill, Mercury, or Tomcat you could try it here too, but I have not tested that myself.

Hope this helps!


For me it wasn't a port or service issue; I had to re-run the XAMPP setup script. Although this didn't directly fix the issue for me, the script was much more verbose than the XAMPP log, pointing me in the right direction to actually solve the problem.

From the XAMPP GUI, click on Shell, type set, press Tab to autocomplete to the setup_xampp.bat file, and then press Enter to run it.

In my case I got the following output:

[ERROR]: Test php.exe failed !!!
[ERROR]: Perhaps the Microsoft C++ 2008 runtime package is not installed.
[ERROR]: Please try to install the MS VC++ 2008 Redistributable Package from the Mircrosoft page first
[ERROR]: http://www.microsoft.com/en-us/download/details.aspx?id=5582

This particular error is misleading. Although it specifies the Visual C++ 2008 Redistributable Package, PHP 7.4.x requires the Visual C++ 2019 Redistributable Package.

After installing that and following the prompt to restart, sure enough I'm now able to start Apache as normal.


I had the same issue, executing "setup_xampp.bat" in xampp folder solved my issue.


I had a hard-coded IP in httpd.conf and my local IP had changed which was causing my issue, changed IP over and all worked again


Try to install x86 version of XAMPP. The default XAMPP version on their website is x64 (maybe because I'm using x64 Windows 7). download link here


I had this issue when I installed under Program Files, which they do not recommend due to write issues. This might only be a problem if you are not logged in as an admin and use a password to install. I just uninstalled and installed in a directory that did not need admin privileges.


In my case, with the same problem and Xampp window, I had copied \apache\conf\extra\httpd-vhosts.conf entries from an old Xampp version to a newly installed one so I could continue to open local projects in browsers. One of the vhosts paths was wrong. After deleting that entry Apache started without problem.

The reference by @Karthik to "in the Event viewer (Control panel -> View Event Logs" saved me time. It's all too easy to presume Xampp logs will point to the problem. It doesn't.


Starting Xampp as a console application (simply by doubleclicking xampp_start.exe in the Xampp root folder) was the only thing that worked for me on Windows 10 (no Skype, no Word Wide Web Publishing Service). WampServer and UwAmp also didn't work.


For those who have accidentally (or not) changed one of the .conf files and apache does not run even after trying all the above solutions.

One easy way to track where the issue is located, is to run Apache via command prompt:

(On windows) : open command prompt as admin then navigate inside the bin folder of Apache , next run

httpd in order to run apache

C:\xampp\apache\bin\httpd

For my case it was :

apache via cmd

someone had added a virtual host in the specific file that caused the problem . I commented the lines and Apache ran fine.


start xampp (as administrator), (1) right click C:\xampp\xampp-control.exe, and run as administrator. (2) unistall service module and then install service module. (3) now try start the apache and mysql.


I had the same issue.Just click on services button.Then find apache and right cick > properties > set startup type as Automatic/ Manual. Now close apache and try again.It will work!

enter image description here