Problems with Apache and .htaccess on a HFS+ partition

28Jun08

Ran across this nasty problem today.

I recently set up a LAMP environment on my laptop, intending to do local development for one of our sites.

I did the usual setup of Apache VHosts and all.. only to find that the site had decided to stopped working. This was pretty strange since I’d just checked out a fresh copy from SVN, and the working copy on the dev server was.. well.. working.

Delving through the logs, I saw Apache trying to do something seemingly strange. It was trying to access files as if they were directories, looking into each of them for .htaccess files.

Like this:

[Sat Jun 28 17:14:36 2008] [crit] [client 127.0.0.1] (13)Permission denied: /home/ruiwen/Projects/app/webroot/favicon.ico/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

Last I checked, favicon.ico wasn’t a directory.

Some Googling turned up this page, which hinted that this behaviour stemmed from the fact the HFS+ might have been presenting the files as directories.

In some cases, this error can also be caused by special file-systems that return unexpected errors on attempted directory access. For example, some file-systems allow files to be treated as directories in certain cases. If httpd believes that a file is actually a directory, it will try to look inside for an .htaccess file. If it gets a permission denied error in return, it will deny access. This type of situation is usually a faulty file-system behavior and cannot be fixed within Apache. In this case your only choice is to turn off .htaccess processing as in the first solution above.

Turning off .htaccess processing wasn’t exactly ideal since the site needed the functionality.

However, setting more relaxed permissions on the site directory as recommended in the second solution on the page seemed to work.

Currently my permissions for the files are

-rwxrwxr-x 1 ruiwen www-data 3322 2008-06-28 16:39 index.php

This seems to work fine for now. Not sure why the relaxed permissions helped the problem though, and will be glad for any insight into this.

Advertisements


No Responses Yet to “Problems with Apache and .htaccess on a HFS+ partition”

  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: