Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|improve this question
You should post the contents of the apache error log. There should be something in there for the 500 errors. – Swoogan Oct 22 '09 at 22:18

You need to add the FollowSymlinks directive, such as:

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


share|improve this answer
Good idea, but why would .txt files be served fine? Apache is seeing the directory just fine, I think its a php setting that is messed up. – Tyler Oct 22 '09 at 21:48
Oh, I didn't catch that part. Looks like it's a php setting. What do the 500 errors produce in the logs? – Swoogan Oct 22 '09 at 22:17

I had the same issue, suPHP was the culprit. Symlinks are always 777 and suPHP enforces 755 and will throw a 500 error.

share|improve this answer

It can be anything, so the best if you check the Apache error log (on 500 you'll get always some error).

Normally Apache follows the link, but it may have SymLinksIfOwnerMatch (instead of FollowSymLinks), so you've to make sure the file and folder which you're accessing (index.php & public_html) has the right owner (owner matches) and permissions are not too wide (should be 755 for public_html).

If you got wrong permissions like 664, you may get this error:

SoftException in Application.cpp:256: File "/home/foo/public_html/index.php" is writeable by group

So this may help:

chown $USER public_html public_html/index.php
chmod 755 public_html

Since you're dealing with symbolic link which has always 777, but it doesn't matter, since permissions of symbolic links are never used. Changing the permissions of destination folder should work fine.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.