Apache not starting in MAMP (but MySQL working) in

2019-03-08 03:31发布

问题:

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

回答1:

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

sudo apachectl stop


回答2:

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)



回答3:

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.



回答4:

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



回答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.



回答6:

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.



回答7:

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!



回答8:

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.



回答9:

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!



回答10:

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.



回答11:

Command line helps for this issue. like the below,

/Applications/MAMP/Library/bin/apachectl start

/Applications/MAMP/Library/bin/apachectl stop



回答12:

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.



回答13:

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.



回答14:

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.



回答15:

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.



回答16:

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.