解决 XAMPP APACHE 端口被占用无法启动
随着需求不断变更,总会安装不同的软件,这些软件理想情况下会使用不同的端口,但还是有软件之间端口被占的情况。小明电脑安装 XAMPP
搭建成了 WEB 服务器,但最近几天在 XAMPP 控制面板上无法启动 APACHE,最终问题被发现和解决。希望本文对您有所启示。
问题描述
1、在 XAMPP 中无法启动 APACHE,错误提示信息如下:
13:52:55 [main] Initializing Control Panel
13:52:55 [main] Windows Version: Windows 7 Ultimate SP1 64-bit
13:52:55 [main] XAMPP Version: 1.8.1
13:52:55 [main] Control Panel Version: 3.1.0 3.1.0 [ Compiled: September 20th 2012 ]
13:52:55 [main] Running with Administrator rights - good!
13:52:55 [main] XAMPP Installation Directory: "d:\xampp\"
13:52:55 [main] Checking for prerequisites
13:52:55 [main] All prerequisites found
13:52:55 [main] Initializing Modules
13:52:55 [main] The FileZilla module is disabled
13:52:55 [main] The Mercury module is disabled
13:52:55 [main] The Tomcat module is disabled
13:52:55 [main] Starting Check-Timer
13:52:55 [main] Control Panel Ready
13:53:00 [Apache] Attempting to start Apache app...
13:53:00 [Apache] Status change detected: running
13:53:02 [Apache] Status change detected: stopped
13:53:02 [Apache] Error: Apache shutdown unexpectedly.
13:53:02 [Apache] This may be due to a blocked port, missing dependencies,
13:53:02 [Apache] improper privileges, a crash, or a shutdown by another method.
13:53:02 [Apache] Check the "/xampp/apache/logs/error.log" file
13:53:02 [Apache] and the Windows Event Viewer for more clues
随后查看错误日志 /xampp/apache/logs/error.log ,无任何内容。
倒数第四行,他说:这可能是由于阻塞端口…,推断出可能站口被占用了。
但是,小明的 APACHE 只监听了 9090、9091、9092,连 80 端口都没有监听,这也会被占用?
另外,APACHE 还需要 443 端口。也就是说 9090、9091、9092、443,,这几个端口不能被其它软件或服务占用!
打算在 CMD 键入端口使用情况的命令,找到软件的PID,随后根据这个ID杀掉对应进程。但有个问题,以后每启动一次都要杀一次进程,这两个软件不能并存了…
用360网络连接查看器(http://www.bugxm.com/uploads/20131026/12201382795181091.rar)查看,然后改掉软件的端口,以后就这两个软件便可以并存了。
解决方案
1、打开连接查看器,点击软件中的“本地端口”进行端口号排序,这样方便查看。

2、寻找 443、9090、9091、9092端口,看是不是被其它软件占用。

3、 从图中我们可以看到 443 端口被vmware-hostd…占用,这个是 VMware Workstation VM
虚拟机软件的进程,我们暂时不封杀它。我们将 APACHE 的 443 端口改成 442 或 444,不就可以了吗?俗话说,退一步海阔天空。。
4、编辑 D:\xampp\apache\conf\extra\httpd-ssl.conf 文件(路径可能不同,视情况而定)将所有的 443 替换成 444 或其它未被占用的端口号。

5、启动 APACHE,问题解决。
