views:

656

answers:

2

I`m using Snow Leopard for web development with PHP. I have a folder in my home directory which is used as the eclipse workspace for the project. I would like to use it as my deployment directory in Apache, so that any changes that i make will be instantly visible.

For that purpose i created an Alias in httpd.conf as follow:

Alias /mysite/ "/Users/mysuser/workspace/mysite"
<Directory "/Users/victor/workspace/mysite">
  Order allow,deny
  Allow from all
</Directory>

However, when i try to access http://localhost/mysite/index.php i get:

   Forbidden
   You don't have permission to access /mysite/index.php on this server.

I have checked the permissions of the folder and all users can read/write/execute on it.

Am i missing something ? Also, is there a better alternative to using aliases pointing to my workspace ? Thanks, Victor.

+1  A: 

Make sure that all the folders above (most likely /Users/mysuser) have permissions for any to read/execute. The execute bit when set for a directory, grants the ability to traverse its tree in order to access files or subdirectories.

To answer the second half of your question, I always use VirtualHosts, and define hostnames (i.e. 127.0.0.1 mysite.local) in my /etc/hosts file. This way you are less likely to have problems with using absolute paths. Your "template" files can link to /css/main.css without having to worry about base path issues...

gnarf
A: 

I am having the identical problem with a 403 error after upgrading to 10.6.

I made absolutely sure that ~/Sites is fully accessible, and have even added an alias (which was oddly renamed 'local.conf') at /private/etc/users that should (?) register ~/Sites with apache when I restart the server.

There is an entry when I try to access localhost in the apache logs that says client access was denied due to the server's configuration:

[Sat Feb 06 10:51:26 2010] [error] [client ::1] File does not exist: /Library/WebServer/Documents/favicon.ico
[Sat Feb 06 10:51:31 2010] [error] [client ::1] client denied by server configuration: /Users/evan/Sites
[Sat Feb 06 10:51:31 2010] [error] [client ::1] File does not exist: /Library/WebServer/Documents/favicon.ico
[Sat Feb 06 11:08:39 2010] [error] [client xxx.xxx.x.x] File does not exist: /Library/WebServer/Documents/HNAP1
[Sat Feb 06 11:08:42 2010] [error] [client xxx.xxx.x.x] File does not exist: /Library/WebServer/Documents/TEADevInfo
[Sat Feb 06 11:08:48 2010] [error] [client xxx.xxx.x.x] File does not exist: /Library/WebServer/Documents/HNAP1

Ideas? Anyone? Thanks!

Evan