Mac – Apache unresponsive on OS X Mountain Lion after upgrade

apache-2.2macmac-osx

I'm having trouble getting Apache set up on my MacBook in Mountain Lion after I upgraded from Leopard. I tried following these instructions. I have the LoadModule php5_module libexec/apache2/libphp5.so line uncommented in /etc/apache2/httpd.conf, I have a my_user_name.conf file in /etc/apache2/users with the contents:

<Directory "/Users/sarah/Sites/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

I have an index.html file in /Users/my_user_name/Sites, chmodded to 644, owned by my_user_name.

  • However, when I go to http://localhost/~my_user_name, I still get 403 Forbidden.
  • I created /Library/WebServer/Documents/phpinfo.php with <?php phpinfo(); ?> in it, and when I view that in the browser, I just see the source code.
  • When I go to http://localhost, I see "It works!". However, after I do sudo apachectl stop, if I visit http://localhost, I still see "It works!"–shouldn't that be inaccessible if I've stopped Apache?

It almost seems like there's some other web server behind my localhost, and that's why my changes to httpd.conf and my_user_name.conf aren't making any difference. Any ideas?

Best Answer

OK, so we've established you're running multiple apache servers.

The first thing I would suggest doing is rebooting -- This is not normally a solution I recommend, but if your system is in some kind of inconsistent state with a half-dead Apache this will resolve it and get you back to a state where the normal tools will work for starting/stopping the web server.

If that fails to get you to a working state you'll have to determine where the extra httpd is coming from (you can use lsof (as root) to determine which httpd.conf file it's reading, which may contain some clues about what installed it, and how you can go about disabling or reconfiguring it)