views:

38

answers:

4

Hi,

I'm starting to unravel the mysteries of PHP and I configured the pre-installed Snow Leopard PHP and activated the Apache server in the system preferences. So far so good: it works if you put a PHP file in your ~/Sites directory.

Since I've my projects in a code/projects directory I created a symbolic link from the ~/Sites dir to the code/projects/one-project/php-dir and bang!, a 403 error: access forbidden.

I've been changing the permissions of the dirs to 777, but no luck.

Is anyone using the default Snow Leoapard configuration for PHP development and if so, how do you link to your codebase?

Thanks in advance, Juan

A: 

That might work if you set FollowSymLinks in your Apache config, but I suggest putting the PHP files under the web root directly.

One good method is to put the presentation files under the web root, and include/require any libraries directly from where they are in the code/projects directory (assuming that dir is readable by the web server user). The include dir shouldn't be writable by the web server, for security. Keep it owned by your user account, and set the permissions to 744.

Alex JL
A: 

Off the top of my head: it might be the FollowSymLink option in the Options directive of Apache (http://httpd.apache.org/docs/2.0/mod/core.html#options).

Flavius Stef
A: 

I presume you have ~/code/projects/projectA/php-dir and ~/sites/php-dir

You need to make sure that the directory above the directory you're sym-linking is readable by the webserver. In this case you need to set the permissions on the folder to 755. Or at least that solved things for me.

videoMonkey
A: 

you'll most likely need to add a Directory directive to your httpd.conf file as well...

<Directory code/projects/one-project/php-dir>
  order allow,deny
  allow from all
</Directory>

Above configuration allows access from all IP's, all hosts.

I myself use macports, I find it better since it isolates everything in the /opt directory. But it's a bit of work to get it running...

Maurice Kherlakian