9

I've been trying to install php, apache, and mySQL in a working fashion for some time now. After attempting manually several times and hitting roadblocks, I ended up just trying to use Xampp.

However, upon startup, the program says:

2:18:39 PM  [main]  Running with Administrator rights - good!
2:18:39 PM  [main]  XAMPP Installation Directory: "c:\xampp\"
2:18:39 PM  [main]  Checking for prerequisites
2:18:39 PM  [main]  All prerequisites found
2:18:39 PM  [main]  Initializing Modules
2:18:39 PM  [Apache]    Apache Service detected with wrong path
2:18:39 PM  [Apache]    Change XAMPP Apache and Control Panel settings or
2:18:39 PM  [Apache]    Uninstall/disable the other service manually first
2:18:39 PM  [Apache]    Found Path: "C:\Apache24\bin\httpd.exe" -k runservice
2:18:39 PM  [Apache]    Expected Path: "c:\xampp\apache\bin\httpd.exe" -k runservice

I followed the suggestions here, but

(a) Changing the port Listen 80 to Listen *:80 or Listen 81 had no effect.

(b) using netstat -ao, there were no local addresses ending with 80.

I've also tried deleting any files related to apache, mysql, and php not in the xampp folder, which were left over from previous install attempts.

Tried xampp 1.8.2, uninstalled, tried 1.8.3, same issue.

For what I can guess, I must've changed some code somewhere outside Xampp before I installed it, and now it is executing when apache is run, changing the path from what Xampp wants (Expected Path: "c:\xampp\apache\bin\httpd.exe" -k runservice) to a path to the now deleted folder C:\Apache24\bin. However, I don"t know where this code might be!

I tried searching my whole C drive for C:\Apache24\bin, but the search came up empty.

Machine: Windows 7 64 bit

Previously installed/uninstalled: Apache2.2, Apache2.4, php5.5.4, MySQL using MySQL Installer 5.6

tried xampp for windows 1.8.2

xampp for windows 1.8.3 currently installed.

Any help?

Community
  • 1
  • 1
  • 1
    You need to remove the previous Apache service(s), e.g. http://stackoverflow.com/questions/11794829/xampp-on-windows-apache-not-starting. – Dave Oct 01 '13 at 20:06

4 Answers4

23

The reason to get this error is because you had Apache installed once before and its service is still running.

If you are using windows 7, click on start and type "services". Open Services and see if Apache is listed. If yes, double click on it to see its properties. Copy the service name (e.g Apache 2.4) by selecting it -> right click -> selecting Copy.

Close the services window.

Click on start and find cmd by typing it. Right click on cmd.exe and select "Run as administrator".

When the cmd window has opened type this command and press Enter:

note: instead of Apache 2.4 you should right click on the window to select paste

sc delete "Apache 2.4"

After pressing enter you should get the message: serviceDelete Success

Open services windows again (I explained it above) and see if you have Apache there again or not.

Aberrant
  • 3,423
  • 1
  • 27
  • 38
Vahid
  • 231
  • 1
  • 3
8

The above answer will probably provide you the solution, but in case it gives an error after you run the command:

sc delete "Apache 2.4"

the error:

The specified service does not exist as an Installed service.

You might want to change the "path to executable" for the Apache service manually. For that, open Registry Edit by using command prompt:

Ctrl+R > regedit

Then go to

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services

and find the service for which you want to change the default path and then locate the ImagePath subkey and change it's value to the Expected Path shown in XAMPP Control Panel.

Ankit Gupta
  • 99
  • 2
  • 5
3

Ctrl+R > regedit

Then go to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services

for me it worked by deleting the apache service,

uninstall the apache. restart the windows

then just reinstall it to the former location it has conflict with.

now it works fine.

zero8
  • 1,997
  • 3
  • 15
  • 25
1

This error is not related to the port.

Inside the two links I explained exactly how this issue can be solved.


https://github.com/MHolger77/Xampp-WrongPath https://www.linkedin.com/pulse/xampp-wrongpath-mohammad-hosein-shamsaei/

Apache

  1. Apache Service detected with wrong path
  2. Change XAMPP Apache and Control Panel settings or
  3. Uninstall/disable the other service manually first
  4. Found Path: "somePath(wrongPath)" -k runservice
  5. Expected Path: "anotherPath(correctPath)" -k runservice

Follow the steps below:

  1. Press WinKey + R
  2. Run regedit
  3. go to "Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\"
  4. Find Apache file (example Apache2.4)
  5. Open Apache file
  6. Open ImagePath
  7. Replace the correctPath with the wrongPath
J'e
  • 3,014
  • 4
  • 31
  • 55