If you’re stuck with MAMP (or MAMP Pro) unable to use the default Apache and MySQL ports (Port 80
and Port 3306
respectively) when you change them in preferences, use the following steps to ensure that the changes you make are saved and work:
- Launch MAMP. Open Terminal by typing terminal into Spotlight (
Command + Space
). - Open MAMP Preferences (
Command + ,
) and click on Reset MAMP Ports (Port 8888
andPort 8889
for Apache and MySQL respectively). Click on OK. - Switch to the terminal. Type
sudo apachectl stop
to shutdown the system Apache. - Restart MAMP.
- Open MAMP Preferences once again and click on Set to Default Apache and MySQL ports. This will set the Apache and MySQL ports to 80 and 3306 respectively.
- Switch to the terminal. Type
sudo apachectl restart
to restart Apache. - Switch back to MAMP and click on Open Start Page (or go to http://localhost/MAMP/?language=English in your browser)
And you’re done.
By using Port 80 for Apache HTTP server, instead of having a URL like http://localhost:8888
you’ll have a clean URL like http://localhost
This is useful in certain cases, for example WordPress multi-site installation where you cannot create a network if “WordPress address (URL)” uses a port number other than ‘:80’, ‘:443’.
Setting preferences in MAMP usually works without a hassle but I encountered this problem, today morning. Only the default MAMP ports seemed to work, no matter what I set in the preferences. This led to a lot of wasted time and productivity. I hope this how-to guide saves you some hair and valuable time.
Wonderful! It works! Many thanks!
Thank you in kind, sir! Works great 😀
Excellent!
I tried this but it isnt working for me on Mamp Pro. When I try to reset the port to 80 in Mamp, when I visit url it automatically goes to :3128…. any idea why?
holy cow…
my hero! been debugging this puppy for for days. ty, what a concise and easy fix.
going in my knowledge base.
—mazal
worked again! yay.
bad news is the issue is repeating. i was able to utilize localhost all day w/out problem, after getting it back last night—using your fix. left the cave for several hours, came back and localhost gremlin resurfaced. i noticed that i have to run your sequence a couple of times to work, and best to reboot the mac entirely before initiating your fix.
if this thread is still active.. is it? any insight as to where its originating? i have a feeling it’s going to be a regular dance, but thanks for providing a meaningful tool.
—mazal
@Mazal, I used to face the same issue initially, and I realized it’s the best to start MAMP before anything else when I switch on my Mac. Days later, the issue didn’t recur even when I started MAMP after using the Mac for quite a while. Only thing I notice is that Apache might take a bit to start some time, but it does start nevertheless and MAMP hasn’t failed me again.
@abhinav.. yes, i see what you mean. thanks.
How do you get to run old software that formerly was running on port 8888?
For instance http://localhost:8888/testdomain doesn’t run on http://localhost/testdomain even after updating the path in the database.
Is this all lost now?
Thanks for your help
Thorsten
Yo Sir… are simply awsm…!!!!
Thank you! This fixed the MAMP problem under Mavericks!
Thanks, saved me a lot of headache!! Very useful
This still didn’t work for me and I have no clue what to do 🙁
Sir, thanks!
Just what I needed, Thanks !
Worked!!!!!! Thanks a lot!!!
I’m having the same problem while running MAMP Pro 3.5.2 with EL Capitan 10.11.6. But this fix isn’t working for me. Just can not get 80, 443 and 3306 to work. Then I noticed, when I try the first terminal line ‘sudo apachectl stop’ It is returning this: “/System/Library/LaunchDaemons/org.apache.httpd.plist: Could not find specified service”. Any ideas? Maybe something to do with running El Cap?
Perfect thanks
Thanks a lot….
Helped a lot and saved my hours..
Nice Work. Thank you. It help to save my time.
Thank you so much for your support, i really appreciate your post and your knowledge…
Bless you, my friend. This has been driving me crazy and your solution fixed it for me!
When I use Terminal, it seems to ask for a password… what do I do about that. It will not take the changes because of that. Tony
Tony, you need to provide your administrator password when running any commands that begin with
sudo
in the terminal.