Php – Apache 500 Error When Using Symlinks

apache-2.2bashPHP

Here is an excerpt of the deployment script I use to deploy php apps on my CentOS server.

echo "Starting Deployment to $SITE_FOLDER (Relase Directory: $RELEASE_DIR)..."
svn --username=$SVN_USER export $REPOSITORY $DEPLOY_FOLDER/releases/$RELEASE_DIR

echo "CHMOD 755 of Release Directory"
chmod 755 -R $DEPLOY_FOLDER/releases/$RELEASE_DIR

echo "Making Symbolic Link."
ln -nfs $DEPLOY_FOLDER/releases/$RELEASE_DIR/ $DEPLOY_FOLDER/public_html

I've used this in a similar environment with success.
I'm setting this up on a new server and files apache was serving files fine from public_html before I deleted it.

Now that its serving via symlink, php files all throw 500 errors.
non .php files are being served fine.

I've tried chowning the directory as different apache users and different permissions, but nothing seems to work. Any ideas? Thanks in advance for help!

Best Answer

You need to add the FollowSymlinks directive, such as:

<Directory /usr/local/httpd/htdocs>
Options Indexes FollowSymLinks
</Directory> 

See http://httpd.apache.org/docs/2.2/mod/core.html#directory

Related Topic