可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I'm trying to view php files locally on my mac.
I'm running Yosemite.
I have MAMP installed on my computer. When I press start the MySQL server starts but Apache doesn't. An error message appears saying 'Error. Apache couldn't be started. Please check your MAMP installation'
I've gone through the internet typing stuff into terminal and changing 'envvars' to '_envvars' but nothing works.
I reinstalled OSX and that worked but when I shut down the computer the problem occurs again.
Can anyone help?
Thanks
回答1:
Check if you changed the Document Root Location or Renamed it. At least this was my mistake.
MAMP > Preferences > Web Server > Document Root
回答2:
I didn't get it working with port 8000 or the default 8888, but did get it working with port 80 per the suggestion here:
http://forums.macrumors.com/showthread.php?t=1744944
That didn't work after all, but it didn't error out. However I manually ran the following at the command line (because log file was empty):
sudo /Applications/MAMP/Library/bin/apachectl start
Only to find that after upgrading I was missing the mod_example.so
httpd: Syntax error on line 83 of /Applications/MAMP/conf/apache/httpd.conf: Cannot load /Applications/MAMP/Library/modules/mod_example.so into server: dlopen(/Applications/MAMP/Library/modules/mod_example.so, 10): image not found
Copied it from my old install and I was good to go.
回答3:
Had the same problem, nothing in the logs. After trying the_dillio's suggestion:
sudo /Applications/MAMP/Library/bin/apachectl start
I got an error that pointed back to my vhosts file. It turns out I had an extra /VirtualHost tag. Removed it and it started working again.
回答4:
Also be aware that if you by any chance deleted the folder that was set as Document Root the last time you were using MAMP, you will get this error. Simply open MAMP again, change Document Root to a location that does exist and start the servers.
回答5:
I think I've found the solution.
It was the wrong port. I altered the .conf file in the Apache folder. I changed all instances of port 8888 to 8000. When I run MAMP now it all seems to work fine.
Thanks for your help
回答6:
If you try to start the server from the terminal, likely that will tell you what is wrong e.g.
$ sudo /Applications/MAMP/bin/startApache.sh
Password:
(48)Address already in use: make_sock: could not bind to address [::]:8888
(48)Address already in use: make_sock: could not bind to address 0.0.0.0:8888
no listening sockets available, shutting down
Unable to open logs
In this case, I was inadvertently running a Blockstack browser out of 8888, so changing MAMP to 8887 allowed it to start. [Your mistake might be different.]
回答7:
I received the same error but interestingly it was caused simply because I renamed the root folder and didn't realize it. Sounds like you have a different issue but for anyone else who gets this error message, make sure you haven't renamed the root!
回答8:
I had this experience when upgrading to V4. It tried to used the files from my previous installation and it just never worked. The workaround was to RENAME the original MAMP installation to something different than "MAMP", install brand new version and then copy files you may need like VHOST configs and DATABASES. After all this it worked just fine.
回答9:
My Apache server problem arose after I enabled SSL on my server and tried a stack overflow suggested Terminal command (eek). So if this is your problem, check your https-ssl.conf file (Applications -> Mamp -> conf -> apache -> extra). The Document Root under the Virtual Host settings had a different file path for htdocs than where it was actually located (easily overlooked on the fly). I changed this to "/Applications/MAMP/htdocs" and presto, problem solved. Perhaps also check Document Root in your https.conf file (Applications -> Mamp -> conf -> apache) to see if it has the correct file path to htdocs too.
回答10:
Absolutely bizarre behavior for MAMP PRO (paid license too btw...)
In my case I had to change the location of the log file in order to get it to work...
Click on Mysql icon then the little folder to the right of the path and try changing it to something else.
回答11:
i've solved this issue using this command in the terminal :
sudo apachectl stop