当 PHPStudy 启动时提示端口被占用,通常是指 Apache/Nginx 的 80 端口或 MySQL 的 3306 端口被其他程序占用。以下是几种解决方法:
查找占用端口的进程:
netstat -ano | findstr "80"
或查找 3306 端口:
netstat -ano | findstr "3306"
记录 PID(最后一列的数字)
终止进程:
taskkill /F /PID [PID]
Listen 80
为其他端口(如 8080)port = 3306
为其他端口(如 3307)常见占用 80 端口的程序: - IIS - Skype - SQL Server Reporting Services - 其他 Web 服务器
常见占用 3306 端口的程序: - 其他 MySQL 实例 - MariaDB
cmd
netsh http add iplisten ipaddress=::
sc config http start= disabled
net stop http
完成上述任一方法后,请重启 PHPStudy 服务以使更改生效。
如果问题仍然存在,可能需要检查系统服务中是否有其他 Web 服务器在运行,并考虑卸载冲突的软件。