多次Apache安装后,Xampp中的Apache出现问题

8 php mysql windows apache

我一直试图以一种有效的方式安装php,apache和mySQL一段时间了.手动尝试几次并遇到障碍后,我最终只是尝试使用Xampp.

但是,在启动时,程序说:

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
Run Code Online (Sandbox Code Playgroud)

我按照这里的建议,但是

(a)将港口Listen 80改为Listen *:80Listen 81无效.

(b)使用时netstat -ao,没有以80结尾的本地地址.

我还尝试删除xapp文件夹中与apache,mysql和php相关的任何文件,这些文件是之前安装尝试遗留下来的.

尝试xampp 1.8.2,卸载,尝试1.8.3,同样的问题.

我可以猜到,在安装之前我必须在Xampp之外的某处更改了一些代码,现在它在运行apache时执行,将路径从Xampp想要(Expected Path: "c:\xampp\apache\bin\httpd.exe" -k runservice)更改为路径到现在已删除的文件夹C:\Apache24\bin.但是,我不知道这段代码可能在哪里!

我尝试在C:\ Apache24\bin中搜索我的整个C盘,但搜索结果为空.

机器:Windows 7 64位

以前安装/卸载:Apache2.2,Apache2.4,php5.5.4,MySQL使用MySQL Installer 5.6

试过xampp for Windows 1.8.2

xampp for windows 1.8.3当前安装.

有帮助吗?

小智 21

出现此错误的原因是您之前安装过Apache并且其服务仍在运行.

如果您使用的是Windows 7,请单击"开始"并键入"services".打开服务并查看是否列出了Apache.如果是,请双击它以查看其属性.通过选择它来复制服务名称(例如Apache 2.4) - >右键单击 - >选择复制.

关闭服务窗口.

单击开始,然后cmd键入它.右键单击cmd.exe并选择"以管理员身份运行".

打开cmd窗口后,键入此命令并按Enter键:

注意:您应该右键单击窗口以选择粘贴,而不是Apache 2.4

sc delete "Apache 2.4"
Run Code Online (Sandbox Code Playgroud)

按Enter键后,您应该收到消息: serviceDelete Success

再次打开服务窗口(我在上面解释过),看看你是否还有Apache.


小智 6

上面的答案可能会为您提供解决方案,但是在运行命令后出现错误:

sc delete "Apache 2.4"
Run Code Online (Sandbox Code Playgroud)

错误:

The specified service does not exist as an Installed service.
Run Code Online (Sandbox Code Playgroud)

您可能希望手动更改Apache服务的"可执行路径".为此,使用命令提示符打开注册表编辑:

Ctrl + R> regedit

然后去

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services
Run Code Online (Sandbox Code Playgroud)

找到要更改其默认路径的服务,然后找到该ImagePath子项并将其值更改为Expected PathXAMPP控制面板中显示的值.