我的 Macbook Pro 上的本地 XAMPP 堆栈运行了数周,运行良好(OS X Yosemite 10.10.3,XAMPP 5.5.24)。然后,我花了一些时间尝试安装一个库,结果不知怎么搞砸了 XAMPP 的安装。现在 Apache 根本无法启动。这是我尝试的。
启动 Apache
$ sudo /Applications/XAMPP/xamppfiles/xampp startapache
XAMPP: Starting Apache...fail.
XAMPP: Another web server is already running.
$ sudo /Applications/XAMPP/xamppfiles/xampp stopapache
XAMPP: Stopping Apache...not running.
因此我尝试找出哪个 Web 服务器已经正在运行。
僵尸阿帕奇
$ sudo lsof | grep AMP | grep apache
$ ps -x | grep apache
7980 ttys000 0:00.00 grep apache
$ ps -x | grep AMP
7990 ttys000 0:00.00 grep AMP
所以我没有看到任何正在运行的网络服务器。
Skype
我关闭了 Skype。还是同样的问题。
端口 80 上的其他监听器
我检查了端口 80 上的其他监听器,正如 mnfc 的回答中所建议的那样。
$ lsof -i -P | grep -i "listen"
SpotifyWe 267 erwin 6u IPv4 0x45f774a11f61c26b 0t0 TCP localhost:4370 (LISTEN)
SpotifyWe 267 erwin 7u IPv4 0x45f774a11f61b99b 0t0 TCP localhost:4380 (LISTEN)
Dropbox 281 erwin 26u IPv4 0x45f774a11f5b926b 0t0 TCP localhost:17603 (LISTEN)
Dropbox 281 erwin 27u IPv4 0x45f774a12399b65b 0t0 TCP *:17500 (LISTEN)
Dropbox 281 erwin 33u IPv4 0x45f774a117b1665b 0t0 TCP localhost:17600 (LISTEN)
$ netstat -atp tcp | grep -i "listen"
tcp46 0 0 *.ftp *.* LISTEN
tcp46 0 0 *.mysql *.* LISTEN
tcp4 0 0 localhost.17600 *.* LISTEN
tcp4 0 0 localhost.17603 *.* LISTEN
tcp4 0 0 *.17500 *.* LISTEN
tcp4 0 0 localhost.4380 *.* LISTEN
tcp4 0 0 localhost.4370 *.* LISTEN
tcp46 0 0 *.http *.* LISTEN
tcp4 0 0 localhost.ipp *.* LISTEN
tcp6 0 0 localhost.ipp *.* LISTEN
$ lsof -i :80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
firefox 7929 erwin 41u IPv4 0x45f774a12db287fb 0t0 TCP erwins-mbp.fritz.box:59555->ea-in-f113.1e100.net:http (ESTABLISHED)
firefox 7929 erwin 48u IPv4 0x45f774a134b4a65b 0t0 TCP erwins-mbp.fritz.box:59558->190.93.244.58:http (ESTABLISHED)
firefox 7929 erwin 54u IPv6 0x45f774a117aff4eb 0t0 TCP [2001:981:b88a:1:7467:5734:ba5f:58b8]:59565->ea-in-x65.1e100.net:http (ESTABLISHED)
firefox 7929 erwin 56u IPv4 0x45f774a11f61a7fb 0t0 TCP erwins-mbp.fritz.box:59574->ec2-23-21-247-182.compute-1.amazonaws.com:http (ESTABLISHED)
firefox 7929 erwin 58u IPv4 0x45f774a125dc499b 0t0 TCP erwins-mbp.fritz.box:59575->ec2-23-21-247-182.compute-1.amazonaws.com:http (ESTABLISHED)
firefox 7929 erwin 59u IPv4 0x45f774a12db2999b 0t0 TCP erwins-mbp.fritz.box:59566->104.16.13.8:http (ESTABLISHED)
firefox 7929 erwin 60u IPv4 0x45f774a134b5199b 0t0 TCP erwins-mbp.fritz.box:59569->ip-82-94-234-88.ams.byte.nl:http (ESTABLISHED)
firefox 7929 erwin 63u IPv4 0x45f774a12db6d7fb 0t0 TCP erwins-mbp.fritz.box:59576->93.184.220.29:http (ESTABLISHED)
firefox 7929 erwin 65u IPv4 0x45f774a13ae124bb 0t0 TCP erwins-mbp.fritz.box:59579->a23-52-59-27.deploy.static.akamaitechnologies.com:http (ESTABLISHED)
firefox 7929 erwin 67u IPv4 0x45f774a1275404bb 0t0 TCP erwins-mbp.fritz.box:59568->ip-82-94-234-88.ams.byte.nl:http (ESTABLISHED)
firefox 7929 erwin 69u IPv4 0x45f774a134b43b3b 0t0 TCP erwins-mbp.fritz.box:59581->server-54-230-130-235.ams50.r.cloudfront.net:http (ESTABLISHED)
firefox 7929 erwin 70u IPv4 0x45f774a12db69b3b 0t0 TCP erwins-mbp.fritz.box:59577->104.16.13.8:http (ESTABLISHED)
作为超级用户:
$ sudo lsof -i -P | grep -i "listen"
Password:
launchd 1 root 26u IPv6 0x45f774a117b02beb 0t0 TCP localhost:631 (LISTEN)
launchd 1 root 34u IPv4 0x45f774a117b19b3b 0t0 TCP localhost:631 (LISTEN)
launchd 1 root 35u IPv4 0x45f774a117b19b3b 0t0 TCP localhost:631 (LISTEN)
launchd 1 root 45u IPv6 0x45f774a117b02beb 0t0 TCP localhost:631 (LISTEN)
httpd 74 root 4u IPv6 0x45f774a117b026eb 0t0 TCP *:80 (LISTEN)
SpotifyWe 267 erwin 6u IPv4 0x45f774a11f61c26b 0t0 TCP localhost:4370 (LISTEN)
SpotifyWe 267 erwin 7u IPv4 0x45f774a11f61b99b 0t0 TCP localhost:4380 (LISTEN)
Dropbox 281 erwin 26u IPv4 0x45f774a11f5b926b 0t0 TCP localhost:17603 (LISTEN)
Dropbox 281 erwin 27u IPv4 0x45f774a12399b65b 0t0 TCP *:17500 (LISTEN)
Dropbox 281 erwin 33u IPv4 0x45f774a117b1665b 0t0 TCP localhost:17600 (LISTEN)
httpd 311 _www 4u IPv6 0x45f774a117b026eb 0t0 TCP *:80 (LISTEN)
httpd 1227 _www 4u IPv6 0x45f774a117b026eb 0t0 TCP *:80 (LISTEN)
mysqld 1832 _mysql 24u IPv6 0x45f774a117b00deb 0t0 TCP *:3306 (LISTEN)
proftpd 1911 daemon 0u IPv6 0x45f774a117afe5eb 0t0 TCP *:21 (LISTEN)
Erwins-MBP:~ erwin$ sudo lsof -i :80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 74 root 4u IPv6 0x45f774a117b026eb 0t0 TCP *:http (LISTEN)
httpd 311 _www 4u IPv6 0x45f774a117b026eb 0t0 TCP *:http (LISTEN)
httpd 1227 _www 4u IPv6 0x45f774a117b026eb 0t0 TCP *:http (LISTEN)
firefox 8014 erwin 68u IPv4 0x45f774a1462ac7fb 0t0 TCP erwins-mbp.fritz.box:64603->ee-in-f113.1e100.net:http (ESTABLISHED)
firefox 8014 erwin 74u IPv4 0x45f774a12db290cb 0t0 TCP erwins-mbp.fritz.box:64598->190.93.246.58:http (ESTABLISHED)
firefox 8014 erwin 82u IPv4 0x45f774a12db5399b 0t0 TCP erwins-mbp.fritz.box:64605->ip-82-94-234-98.ams.byte.nl:http (ESTABLISHED)
终止 80 端口上的其他监听器
我想终止现有的 httpd 进程。我首先关闭了所有其他应用程序,包括 Firefox。当我尝试使用sudo killall httpd
或终止它们时sudo kill 1227
,它们并没有消失。我仍然无法启动我的 Apache 服务器。
完成全新安装
我彻底卸载了 XAMPP,删除了目录,然后从安装包重新安装了 XAMPP。我重启了 Macbook。问题依然存在。
答案1
经过几个月的尝试,我终于让它工作了。我找到了解决方案这里:禁用OSX内置的Apache服务器。
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
答案2
netstat -atp tcp | grep -i "listen"
Achive Internet connections (including servers)
Proto Recv-Q Send-Q Local Address Foreign Address (state)
tcp4 0 0 localhost.25035 *.* LISTEN
sudo lsof -i -P | grep -i "listen"
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
GitHub 850 grgarside 6u IPv4 0x23c345381d089301 0t0 TCP localhost:25035 (LISTEN)
答案3
对于任何寻求答案以在 Xamps 上启动任何服务器的人来说(已经研究这个问题太久了)。
通过终端执行:我发现这个链接肯定有帮助:
http://daplo.net/solved-mac-os-x-xampp-mysql-server-is-not-starting/
mysql-sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start
阿帕奇sudo /Applications/XAMPP/xamppfiles/bin/ftpdctl start
希望有所帮助。
干杯