问题
When attempting to start my servers, Apache fails to start, and MAMP claims that the port ([::]:8888) is already in use.
I have tried virtually every way I know of determining what process is using that port (as well as many of the solutions previously listed on SO), but I get no results. Neither lsof or netstat list anything about port 8888. There does not appear to be anything using this port at all.
I need to either improve my search and find what(if anything) is really using the port, or somehow convince MAMP that the port is not actually in use. Any suggestions?
EDIT: Changing the port to 8887 allows Apache to start. This doesn't change the fact that nothing is using port 8888 and it should work with that port.
回答1:
Try going to activity monitor and searching for Mysqld and Httpd and end any processes for them. Then restart Mamp.
回答2:
Killing all httpd and Mysqld processes fixed the problem for me. I had about 10 instances of httpd running. Not sure why.
回答3:
After upgrading to bash-4.3.27-10.4u, I also noted that apache fails to start on port 8889 using MAMPS 1.7.2 running on Mac OS X 10.6.8 on an Intel Core Duo. Sigh. The solution seems to be to revert to the older versions of bash and sh.
Subsequent investigations confirm that EITHER the new sh OR the new bash OR both will prevent apache from launching.
回答4:
Sorry for the late answer. This command would tell you what process or daemon is using 8888:
sudo lsof -P -n -iTCP -sTCP:LISTEN
If you don't like it, fell free to kill the process ID using kill (or killall for Process name)
回答5:
Open => MAMP => Preferences => Port => Change Apache port 8888 to 8080
Restart MAMP. It will work.
回答6:
Turned out my Mac's Apache started while installing a PHP extension to be later used with MAMP. I then simply stopped it. Then MAMP started to work again.
sudo apachectl stop
回答7:
if you go to
preferences > when quitting MAMP > check 'stop servers'
when you will quit MAMP it will kill all the processes listed above.
来源:https://stackoverflow.com/questions/26124504/mamp-pro-apache-couldnt-be-started-because-the-port-was-already-in-use