Since upgrading to OS X Yosemite DP I have had trouble using Apache on my Mac, and previously fell back to using MAMP. Since OS X 10.10 DP5, now MAMP does not work either. So I figured I had to fix this issue the hard way (I am not very skilled with raw server setup). I have tried however, without success, and I do now know where to look next.
This is what I have done:
After seeing this result I of course checked if the Aoache service was indeed running:
OK. Then I figured it must indeed have been my Apache configuration that was wrong. And rightfully so, prompting apachectl in Terminal I found that the Apache config had parsing errors (probably because Apache was updated when updating to OS X 10.10, but the config file not following? Anyway, I followed instructions to get a valid config file with a minimum of installed modules (.so-files taken from location of previous installation).
A copy of my httpd.conf can be seen on http://pastebin.com/VU5aZ6vL, but key variables are listed here:
ServerRoot "/usr"
Listen 127.0.0.1:80
LoadModule authz_core_module libexec/apache2/mod_authz_core.so
User daemon
Group daemon
ServerName localhost:80
<Directory />
AllowOverride none
Require all granted
</Directory>
DocumentRoot "/Users/casparjespersen/Sites/"
Still, the result is the same. Any ideas where to look next?
I had the same problem. Quick fix: http://www.ampps.com/ does still work for me for a basic Apache/MySQL setup.
But AMPPS lacks of many great features I love with MAMP.
This will help you just follow the instructions:
http://coolestguidesontheplanet.com/get-apache-mysql-php-phpmyadmin-working-osx-10-10-yosemite/
After researching setting up Apache on Yosemite this issue was explained - the solution is to implicitly add localhost at the top, before your Virtualhost block pointing to 127.0.0.1... Sorry I can seem to find the YouTube link that explained this.
Related
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
Check if you changed the Document Root Location or Renamed it. At least this was my mistake.
MAMP > Preferences > Web Server > Document Root
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.
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
What you can do 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.]
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.
i've solved this issue using this command in the terminal :
sudo apachectl stop
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
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.
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!
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.
For MAMP :
You can open the terminal and write:
ps aux | grep mysql
lsof -i
killall -9 mysqld
I hope is good for you!
Bye
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.
My Apache server problem arose after I enabled SSL. So if this is your case, 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). I changed this to "/Applications/MAMP/htdocs" and 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.
These are the steps I used to solve this issue.
Checking vcredist that are required and installing them. to check which are the missing vcredist I used a tool called "check_vcredist" from wamp.
I also installed latest Microsoft Visual C++ Redistributable x64.
Doing this steps solved my issue of Apache server not running
I've been having a bit of a headache since upgrading to Yosemite. Typically, I run a gulp or grunt connect package that spawns a Node server on port 9000. I hit the page by going to http://localhost:9000. However, after firing up the server, that URL gives me a 404.
I ran $apachectl configtest and got the following:
"AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using jake.local. Set the 'ServerName' directive globally to suppress this message"
"jake.local" is my computer name. Coincidentally (or maybe not?), when I go to jake.local:9000, I get my website and no 404.
I'm not an Apache expert by any means, but I have followed this tutorial with no luck: Apache localhost/~username/ not working... and have ended up just reverting my httpd.conf because the instructions won't work for me. I'm starting to think I might have a different issue, as it's my understanding that out of the box, Yosemite should just live me a "It Works!" when I hit http://localhost
I'm not sure how to proceed, but I'd like localhost to work again and not have to use my computer name. How would I go about doing this?
Any help would be greatly appreciated. Thank you!
EDIT:
127.0.0.1:9000 also gives me positive results. In my host file, I have:
127.0.0.1 localhost
After many hours of searching, I discovered there's a line in my hostfile leftover from Mavericks:
#in /etc/hosts
fe80::1%lo0 localhost
If you have that, remove it.
I've been reading about this issue and have tried many things, but none seem to work for me. After being very frustrated with XAMPP, I'm trying to setup a development environment locally using the apache that's already installed (along with php and mySQL).
Whenever I do:
sudo apachectl start
Nothing happens, and the console displays:
8/23/13 3:21:08.262 PM com.apple.launchd[1]: (org.apache.httpd[1086]) Exited with code: 1
8/23/13 3:21:08.262 PM com.apple.launchd[1]: (org.apache.httpd) Throttling respawn: Will start in 10 seconds
I've tried doing the suggestion that is most common, which seems to be to make a directory for the error log, and chmod 777 it.
If I do:
sudo apachectl -t
I get:
Warning: DocumentRoot [/usr/docs/dummy-host.example.com] does not exist
Warning: DocumentRoot [/usr/docs/dummy-host2.example.com] does not exist
httpd: Could not reliably determine the server's fully qualified domain name, using 10.5.120.124 for ServerName
Syntax OK
I see that my IP address is in the 3rd line there, and I'm thinking maybe that's the source of the issue? If anyone can give me any advice as to what might help, that'd be great.
Thanks!
Just to follow up on this for anyone else that might be encountering this issue, it ended up being something amiss in my Virtual Hosts file. After combing through that, there were some syntax issues going on that was, in turn, causing this issue to happen.
I want to start Apache in Mac. If I make web sharing enable by checking in system prefs -> web sharing, Apache works. But if I input command in terminal: sudo apachectl start, Apache doesn't start. In this case, when run http://localhost in Safari, it always said The requested URL / was not found on this server. In both cases, I used the default httpd.conf.
Therefore, How can I start Apache and make it work in Mac by inputting command in a terminal instead of by the graphical config window of mac itself? I prefer to command in a terminal.
Thank you.
Figure it out. The point is from the words of /etc/apache2/httpd.conf:
The <IfDefine> blocks segregate server-specific directives
and also directives that only apply when Web Sharing or
server Web Service (as opposed to other services that need Apache) is on.
The launchd plist sets appropriate Define parameters.
The action of Web Sharing in mac (system prefs -> web sharing) in nature first launches plist to set appropriate Define parameters, then calls apachectl. If we read httpd.conf, we can find the file is structured in several sections -- <IfDefine xxxx>yyyyy</IfDefine> based on the parameters from plist.
If we call the command sudo apachectl start in terminal like what we usually do in linux, the Define parameters from plist can't be set. Although httpd is up, it is not configured appropriately, e.g., in my case, DocumentRoot is not set at all because the parameter is surrounded by
<IfDefine !MACOSXSERVER>
<IfDefine WEBSHARING_ON>
DocumentRoot "/Library/WebServer/Documents"
</IfDefine>
</IfDefine>
This is why the error log said [error] [client 192.168.1.2] File does not exist: /usr/htdocs. As to /usr/htdocs, it is not set in any configure file but is hardcoded in Apache. It is the "last resort" place to look for.
If we comment #<IfDefine !MACOSXSERVER> and #<IfDefine WEBSHARING_ON> and the two #</IfDefine>, call sudo apachectl start in terminal. Then everything is ok.
It took me a full day of work to finally straighten this out. I hope it is useful to those guys who are used to be Linux and especially prefer to command line in terminal like me and just move to Mac.
I need some help getting this to work. It's starting to get on my nerves and I'm sure I'm missing some bizzarely simple and easy oversight somewhere to get this to work. I have Apache 2 setup with XAMPP. I'm running snow leopard 10.6, I have Tomcat running on localhost:8080 just fine. I made and installed the mod_jk.c and is in /usr/libexec/apache2
When I put in this code:
LoadModule jk_module /usr/libexec/apache2/mod_jk.so
Apache says back to me:
/Applications/XAMPP/xamppfiles/etc/httpd.conf: Cannot load /usr/libexec/apache2/mod_jk.so into server: cannot create object file image or add library
I've re-installed mod_jk a couple times. I've placed it in different spots by the "cp" command (like /Applications/XAMPP/xamppfiles/modules/) and nothing seems to work. Running out of options to get this to work. Please help.
do you have something like APACHE_DIR/modules/?
are you sure you .so file is not corrupted? or what version you have? 32bit or 64bit?