62

I've had MAMP working for a few months and recently installed PostgreSQL. It recommended installing Apache as well, which I did to make sure PostgreSQL worked. I then uninstalled PostgreSQL and the apache build and tried to restart MAMP. It fired up the MySQL database (green light) but Apache didn't start. I uninstalled and reinstalled MAMP only to face the same problem.

Apache doesn't seem to be logging any errors in the MAMP folder, so without any errors to report I'm struggling with where to begin fixing it. I'm hoping its to do with the fact that I installed another version (and deleted it) that has caused the problem but I'm too inexperienced to know what I've done.

Where might I find any errors if not in the MAMP folder? Not in:

  • /Applications/MAMP/Library/logs
  • /Applications/MAMP/bin/logs
Djave
  • 8,595
  • 8
  • 70
  • 124

16 Answers16

151

Stoping the Apache solved this issue for me, using the command-line:

sudo apachectl stop
Qullbrune
  • 1,925
  • 2
  • 20
  • 20
  • 1
    How did you find this out? – halfpastfour.am Feb 06 '15 at 18:45
  • trial and error - I had the information, that some ports were blocked and so I tried to unblock them – Qullbrune Feb 19 '15 at 10:34
  • 13
    /System/Library/LaunchDaemons/org.apache.httpd.plist: Could not find specified service – KSPR Dec 10 '15 at 15:59
  • 6
    KSPR - that's what I get too. But, I'm on El Capitan. BUT - if I start Apache directly in MAMP with this: "/Applications/MAMP/Library/bin/apachectl start" It works. So odd. – TheTC Apr 25 '16 at 20:22
  • This is really helpful to find the cause of the issue as well. For example this didn't work for me but at least the command line returned a response telling me why. – mylesthe.dev Aug 08 '16 at 02:02
  • 1
    Worked perfectly in Sierra 10.12.3. @Cage - If you're getting "command not found" you're probably including the $. The actual terminal command is just sudo apachectl stop. The $ just denotes the normal user (as opposed to root user) in a BASH terminal. You don't typically enter the $, it's already there. – danzo Feb 24 '17 at 17:34
  • This worked for me on El Capitan 10.11.6. A quick comment to remind folks you may need to clear your browser cache too - I forgot to do so at first and, while Apache started working again after running this command, I was just getting an "It works!" page for localhost. Once the cache was cleared, everything was back to normal. – murph Jul 11 '17 at 15:32
  • Above command failed with this error. "/System/Library/LaunchDaemons/org.apache.httpd.plist: Could not find specified service" But this command starts Apache server. "/Applications/MAMP/Library/bin/apachectl start" – gmspacex Dec 23 '20 at 12:17
  • Pay attention: if you start MAMP Apache with the apachectl start|stop command, you won't get the configurations made in MAMP dashboard (like specific PHP version and so on...). I set PHP 7.0.33 in MAMP configuration, but starting Apache from apachectl, it uses PHP5.4.46 – Ma3x May 12 '21 at 13:18
44

For those of you upgrading to Yosemite there seems to be a bug which I don't really understand but its easily fixed as posted on their twitter account.

Workaround for the 10.10 Preview 5 bug: Rename the file “envvars” located in '/Applications/MAMP/Library/bin' into “_envvars” (@mamp_en)

Jose Torres
  • 1,025
  • 11
  • 21
  • It worked in MAMP pro 3.0.5 in Sierra as well but the answer at top gave me the error "/System/Library/LaunchDaemons/org.apache.httpd.plist: Could not find specified service". Thanks for the quick fix. – Mike Lucid Sep 14 '17 at 07:32
41

I had a similar problem and could solve it by starting on the command line the apachectl included in MAMP:

$ /Applications/MAMP/Library/bin/apachectl start

which would yield

Syntax error on line 427 of /Applications/MAMP/conf/apache/httpd.conf:
Invalid command '\xef\xbf\xbc#AllowOverride', perhaps misspelled or defined by a module not included in the server configuration

This error message was nowhere else, not in any log file or system console. (Turns out I had copied a line from a documentation file which had copied some special characters that were not intended for my system - how easy to find is that!)

This is for MAMP 2.0.1, maybe it's handled better in newer versions.

DonCristobal
  • 1,965
  • 21
  • 21
  • great answer, check first if httpd.conf is OK. I had an error in the file which prevented Apache from starting correctly had nothing to do with mamp – San Bluecat Apr 10 '15 at 16:55
  • 1
    I'm able to manually start apache like this, but it doesn't give me any errors and MAMP still isn't able to start or stop it. – Matt van Andel Sep 15 '16 at 03:40
  • Woah! worked for me! had to use `sudo` for root permissions! – arora Mar 15 '17 at 04:31
  • `$ /Applications/MAMP/Library/bin/apachectl start`was enough to restart apache. – Sébastien Gicquel May 28 '18 at 13:22
  • (48)Address already in use: make_sock: could not bind to address [::]:80 (48)Address already in use: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down – Jithin U. Ahmed Jul 24 '18 at 06:40
7

Change the recommended Apache Port from: port 80 to port 81.

Bartosz Marcinkowski
  • 6,651
  • 4
  • 39
  • 69
johnfleff
  • 87
  • 1
  • 2
6

I have been going through all Stackoverflow posts, but no luck. Finally, I came across this: https://www.speakinginbytes.com/2013/02/mamp-problems/

Sometimes Apache is set through MAMP to open a particular folder and that folder no longer exists. If you simple go to MAMP and change that setting through the preferences button you should be able to fix it.

That did the trick for me. Hopefully it will help someone else!

Lucas
  • 193
  • 2
  • 9
  • In my particular instance I removed all but one host. That did the trick for me. Apparently one or more of my hosts had been deleted since I had rebooted and MAMP did not identify the directory that was missing. – Josh C Aug 05 '17 at 02:34
5

Maybe its because the original apache is on. Have you tried to see the status ? You can try this command to stop it "apachectl status" and then restart mamp and see if it works.

jamel
  • 75
  • 6
5

I know this is old but in case someone else comes across this. I had a typo in my Virtual Host file (/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf) that was causing Apache not to start. It wasn't until I manually tried to start MAMP's version of Apache from the command line (/Applications/MAMP/bin/startApache.sh) that I saw the error and was able to fix it.

micahmills
  • 868
  • 3
  • 14
  • 22
3

Command line helps for this issue. like the below,

/Applications/MAMP/Library/bin/apachectl start

/Applications/MAMP/Library/bin/apachectl stop

  • dyld: Symbol not found: __cg_jpeg_resync_to_restart Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO Expected in: /Applications/MAMP/Library/lib/libJPEG.dylib in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO /Applications/MAMP/Library/bin/apachectl: line 80: 35578 Trace/BPT trap: 5 $HTTPD -k $ARGV – Design by Adrian Jun 07 '16 at 09:43
2

I had the same problem. After a lot of frustration about not having a descriptive error message, I realized I could check the "All messages" log under Applications/Tools/System messages (or some similar path, as I just translated from my language here). There I found the explanation, which in my case meant that a library link was broken (probably due to the uninstallation of postgres). I fixed this by recreating the link. In my case it meant I had to run the following command in the terminal:

sudo ln -s /usr/lib/libpq.5.3.dylib /usr/lib/libpq.5.dylib

and now it works!

Matthias Robbers
  • 15,689
  • 6
  • 63
  • 73
Lukas Kalinski
  • 2,213
  • 24
  • 26
2

If it has at one point been working fine then I guess something else on your network is currently using the same port for something else.

I had this problem too: in my case I had changed the default MAMP Apache port from 8888 to 80. It worked fine until I installed a web server on another machine on my network and tweaked /etc/hosts on my local machine to include the new server. This meant that port 80 was already in use and MAMP's Apache couldn't start.

The solution was to either stop the second web server on my network, or revert MAMP back to 8888. Both approaches worked fine.

Jay Versluis
  • 2,062
  • 1
  • 19
  • 18
2

In my case was a wrong ssl certificate on an vhost. To test, just temporarily deactivate ssl from all your ssl vhost and see if it starts. NOTE: even if the ssl vhost are not checked.

Luca Reghellin
  • 7,426
  • 12
  • 73
  • 118
2

1) Quit MAMP

2) Use the command-line to run:

$ sudo apachectl restart

3) Open MAMP and start Apache

4) Apache should start this time with any luck


My situation was that when I used the command-line to run:

$ sudo apachectl stop

nothing changed. And when I used the command-line to run:

$ sudo apachectl start

I received the message

httpd (pid 600) already running

I tried restart instead and it worked.

davesmiths
  • 201
  • 2
  • 3
1

To fix this particular issue, I reinstalled PostgreSQL and the apache build that came with it, then I installed MAMP again and MAMP worked fine.

Djave
  • 8,595
  • 8
  • 70
  • 124
1

If your htdocs (or equivalent) folder is stored on external storage, you may need to connect to it (in finder, or using cmd + K) before apache will start.

Djave
  • 8,595
  • 8
  • 70
  • 124
1

I had this problem and it turned out that a .txt file that was not a vhosts file had somehow been saved to my sites-available folder that Apache was automatically including, and expected every file to be a vhosts file.

beth
  • 1,916
  • 4
  • 23
  • 39
0

Also make sure you're not launching an older version of MAMP. This happened to me when using spotlight to find MAMP. When the app upgrades, it keeps older copies around in your Applications folder.

dloewen
  • 975
  • 1
  • 10
  • 26