安装启动XAMPP遇到的问题

成功下载安装XAMPP之后,打开xampp-contrl.exe。发现无法启动界面里面的功能,log报错如下:

14:48:01  [Apache]     Problem detected!
14:48:02  [Apache]     Port 80 in use by "Unable to open process" with PID 4!
14:48:02  [Apache]     Apache WILL NOT start without the configured ports free!
14:48:02  [Apache]     You need to uninstall/disable/reconfigure the blocking application
14:48:02  [Apache]     or reconfigure Apache and the Control Panel to listen on a different port
14:48:02  [Apache]     Problem detected!
14:48:02  [Apache]     Port 443 in use by ""D:\Program Files (x86)\虚拟机\vmware-hostd.exe" -u "C:\ProgramData\VMware\hostd\config.xml"" with PID 3520!
14:48:02  [Apache]     Apache WILL NOT start without the configured ports free!
14:48:02  [Apache]     You need to uninstall/disable/reconfigure the blocking application
14:48:02  [Apache]     or reconfigure Apache and the Control Panel to listen on a different port
14:48:02  [mysql]     MySQL Service detected with wrong path
14:48:02  [mysql]     Change XAMPP MySQL and Control Panel settings or
14:48:02  [mysql]     Uninstall/disable the other service manually first
14:48:02  [mysql]     Found Path: "D:\Program Files\MySql\mysql-8.0.23-winx64\bin\mysqld" MySQL
14:48:02  [mysql]     Expected Path: d:\program files\xampp\mysql\bin\mysqld.exe --defaults-file=d:\program files\xampp\mysql\bin\my.ini mysql
14:48:02  [mysql]     Problem detected!
14:48:02  [mysql]     Port 3306 in use by "Unable to open process"!
14:48:02  [mysql]     MySQL WILL NOT start without the configured ports free!
14:48:02  [mysql]     You need to uninstall/disable/reconfigure the blocking application
14:48:02  [mysql]     or reconfigure MySQL and the Control Panel to listen on a different port
 

尝试启动Apache,log显示如下报错

14:48:29  [Apache]     Attempting to start Apache app...
14:48:29  [Apache]     Status change detected: running
14:48:30  [Apache]     Status change detected: stopped
14:48:30  [Apache]     Error: Apache shutdown unexpectedly.
14:48:30  [Apache]     This may be due to a blocked port, missing dependencies, 
14:48:30  [Apache]     improper privileges, a crash, or a shutdown by another method.
14:48:30  [Apache]     Press the Logs button to view error logs and check
14:48:30  [Apache]     the Windows Event Viewer for more clues
14:48:30  [Apache]     If you need more help, copy and post this
14:48:30  [Apache]     entire log window on the forums 

一、尝试从第一个问题入手,80端口被占用。

1. 打开cmd,输入netstat -ano,查看所有端口信息以及其占用应用的PID。

 

查看被占用端口的应用是什么,需要查看其PID,依次输入命令

netstat -ano|findstr "80"    -->pid:4

netstat -ano|findstr "443"        -->pid:3520

netstat -ano|findstr "3306"        -->pid:6376

2.找到对应的Pid,那么还需要找到对应的程序软件,依次输入命令

tasklist|findstr "4"

tasklist|findstr "3520"

tasklist|findstr "6376"

2.1在这里需要思考一下,停掉pid=4的system应用程序会有什么后果,并且弄清楚taskkill命令后缀的意义:

/S        system               指定要连接到的远程系统。
/U       [domain]user     指定应该在哪个用户上下文执行这个命令。
/P        [password]        为提供的用户上下文指定密码。如果忽略,提示输入。
/FI       filter                   应用筛选器以选择一组任务。允许使用 "*"。例如,映像名称 eq acme*
/PID    processid           指定要终止的进程的 PID。使用 TaskList 取得 PID。
/IM     imagename        指定要终止的进程的映像名称。通配符 '*'可用来指定所有任务或映像名称。
/T                                  终止指定的进程和由它启用的子进程。
/F                                  指定强制终止进程。
/?                                  显示帮助消息

如果不使用名称,使用进程号,则用/PID,例如(假设已知道某进程的PID号是4,PID号可以在windows任务管理器中查看):
taskkill /f /pid 4

一般情况下,就是直接杀死,但是系统级别的不能直接杀死,一般是系统安装某软件之后启动进城后出现的该端口,就像安装了XXAMP之后启动,才出现的该80端口。
 

2.2 端口80被System占用,一般肯定是HTTP服务导致的

输入命令:netsh http show servicestate

我的理解是,HTTP只是一个协议,那么80端口只是和这个协议相互绑定的端口。真正使用这个端口和协议的进程肯定会在HTTP服务状态的快照留下记录,通过这个命令可以找到这个进程。而且,通过tasklist|findstr "4"命令得到的信息非常多,可能是因为这些进程与system.exe共用80端口,所以会一并输出出来。

 

 回到netsh http show servicestate命令,显示得到的应用进程PID=6212,同时其对应的是svchost,exe。

找到对应的PID以及相对应的应用,通过taskkill /m /t /pid ****(PID号码)将其关闭,自此该端口就可以被其他进程使用了。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值