Apache "Forbidden" Error after Leopard Upgrade

Hopefully this is really simple.

I have just upgraded from Tiger to Leopard and as part of that process Apache 2.2 was installed where before I had Apache 1.3. Interesting the upgrade turned Web Sharing OFF - nice - however that was easily overcome in System Preferences.

However, I know next to nothing about Apache so cannot easily solve the next problem. Now whenever I try to access http://localhost/~Username Apache returns "Forbidden - You do not have permission".

It would be much appreciated if anyone could let me know where I need to put the 'tick-in-the-box' or amend some configuration setting. Thanks in advance.

MacBook Pro, Mac OS X (10.5)

Posted on Oct 26, 2007 10:24 AM

Reply
20 replies

Oct 26, 2007 11:06 AM in response to Jason Kerner

Jason,

Brilliant, as you say in the linked post - boom! its working now.

Or .... at least for standard HTML. That has now just uncovered the fact PHP is not running on Apache even though I installed entropy 5.2.4 for Apache 2 after the leopard update.

I am going to re-read your linked post to see if that can provide help on the PHP issue. Cheers.

Oct 26, 2007 4:27 PM in response to WestD

The post by Jason was excellent and solved the PHP issue as well.

However, for those that are interested, I then had a MySQL error where I could not connect to MySQL due to a socket issue (error 2002). It appears that the socket has changed from /tmp/mysql.sock to /var/mysql/mysql.sock. I do not pretend to understand how or why, however the following article on the apple web site did solve my issue:- http://docs.info.apple.com/article.html?artnum=301457

Note: I solved this via the my.cnf option and not the php.ini solution which I could not get to work by trying to set it to the original 'tmp' file even though the article indicates this is the preferred option.

Oct 27, 2007 8:33 AM in response to WestD

I finally got my Leopard Apache configuration working with PHP5 and with MySQL. I also solved (finally) the forbidden errors I was seeing. Here are some of the changes I made.

1. My read permissions on my website files and directories were configured correctly so I suspected that something inside my httpd.conf file was amiss. Inside /etc/apache2/httpd.conf, I commented out two lines in the <Directory> block. This fixed the "forbidden" messages I was seeing for my virtual hosts. See below:
<Directory />
Options FollowSymLinks
AllowOverride None
# Order deny,allow
# Deny from all
</Directory>

2. I used the system.log in Console to detect and fix httpd.conf syntax errors. If you have syntax errors in any of your httpd.conf files, apache2 under Leopard will not start.

3. I removed the comment character from the start of the line below inside httpd.conf:
LoadModule php5_module libexec/apache2/libphp5.so

I am now back to where I was with Tiger.

Nov 27, 2007 1:43 PM in response to WestD

I too was having those 403 errors. I followed peoples' directions:
- I enabled PHP in the httpd.conf file
- I created a new file in apache2/users/shortusername.conf with the following contents:
<Directory "/Users/shortusername/Sites/">
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
However, I now get a "Cannot connect to server" whenever I try to navigate to http://localhost/~shortusername/. I can still navigate to http://localhost/ and get the generic Apache page, though. Anyone have any idea as to what's up?

Thanks

Nov 27, 2007 2:48 PM in response to xnav

There are a couple of errors that appear in Console. They appear continuously as long as Web Sharing is active:

11/27/07 4:43:05 PM org.apache.httpd[217] httpd: Syntax error on line 455 of /private/etc/apache2/httpd.conf: Syntax error on line 15 of /private/etc/apache2/extra/httpd-userdir.conf: Syntax error on line 1 of /private/etc/apache2/users/shortusername.conf: /private/etc/apache2/users/shortusername.conf:1: <Directory> was not closed.

Then afterwards:

11/27/07 4:43:47 PM com.apple.launchd[1] (org.apache.httpd[221]) Exited with exit code: 1

Then:

11/27/07 4:43:47 PM com.apple.launchd[1] (org.apache.httpd) Throttling respawn: Will start in 9 seconds

Then it repeats. It would seem that it doesn't like something in the shortusername.conf file. Again, what I posted above is all that I have in there - do I need any headers or any specific kind of formatting for that file?

The apache error log is rather lengthy - would it help for me to post it, or will these errors be enough?

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Apache "Forbidden" Error after Leopard Upgrade

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.