Today I encountered a conflict between the default Apache Server on my MacBook Pro laptop and Apache in MAMP Pro. I was following a course by Kevin Skoglund on lynda.com entitled “PHP with MySQL Essential Training”, in which we were learning how to get Apache to serve up files from a “Sites” folder. This course doesn’t discuss WordPress PHP, but PHP the scripting language, and its relationship to MySQL. It also introduces the use of Command Line and Mac OSX‘s default Apache Server. He was explaining how this “Sites” folder had been the default folder for local web development installs prior to OS 10.8, but that with 10.8, it was no longer supported. True. However, people like myself, who have been using Macs for a long time, as well as the “Sites” folder for web development, the Sites folder still exists. On top of it, some of us don’t just use the free version of MAMP, which uses the url http://localhost:8888/. We use MAMP Pro, which uses localhost. Now this can pose a problem if you want to use Apache via Terminal for your local installs. If you configure Apache to have the permission to serve up files from the same localhost as MAMP Pro, a clear conflict occurs. MAMP Pro, unlike MAMP, uses localhost/ instead of http://localhost:8888/. In addition, MAMP Pro’s Apache Port is 80, and obviously not 8888. That’s why localhost/ and not http://localhost:8888/.
So when I configured Apache to serve up files via localhost, all my MAMP Pro local installs were no longer available! There are a couple of things going on here that one has to be aware of regarding MAMP Pro. As I mentioned in my previous post “Troubleshooting MAMP Pro”, in order for MAMP Pro to work properly, the localhost install has to work properly. More specifically, in order for MAMP Pro to work at all, there has to be a fully functioning localhost install. So I asked myself, “How am I going to reverse the effects of introducing my default Apache into the local development picture?” I emailed lynda.com to tell them of my woes. I called customer service to make sure that a live human being knew of my plight. I did find out, however, that my email would go directly to Kevin. So that was good! I was a bit more relieved, because I knew that he would know how to get me out of my jam. But I didn’t want to just give up and wait days to hear back from him. I searched for answers on Google. Low and behold, I finally came up with an answer, and it worked! At least mostly. This is what I discovered:
OS X comes with apache installed by default. This creates a port conflict with MAMP because only one application can use a given port at any given time. The solution is to go to
If you’re using a version of OSX before Mavericks (I read maybe also before mountain lion but I can’t confirm) Apple Icon -> System Preferences -> Sharing -> Web Sharing (uncheck)
If you’re using Mavericks (or maybe mountain lion) then you’ll have to disable it by opening up terminal and using the following command.
sudo defaults write /System/Library/LaunchDaemons/org.apache.httpd Disabled -bool true
make sure to restart your computer afterwards or run the command to stop the current apache process:
sudo /usr/sbin/apachectl stop
To view the original contribution on Team TreeHouse Forums, click here.
I didn’t have to “stop the current Apache process”. I just restarted the computer after typing
sudo defaults write /System/Library/LaunchDaemons/org.apache.httpd Disabled -bool true.
Then I launched MAMP Pro and checked out my localhost install and my MAMP Pro local installs. They were accessible!
If you ever find yourself in a similar bind, just take these steps to turn off the default Apache Server on your computer, and you should be able to access your MAMP Pro local installs again. What’s interesting is that MAMP Pro’s Apache Server never failed to start when I encountered this conflict. I wasn’t able to access my installs, but Apache appeared to be running. The Apache checkbox was always green. Same with MySQL. Go figure.