suPHP and PHP script symbolic links

babakb

Well-Known Member
Jan 20, 2007
47
0
156
I was under the impression that unlike with phpsuexec, with suPHP symbolic links to PHP scripts would work. But this is not consistent with the behavior I'm observing. e.g.

/home/user/public_html/test.php

is a symbolic link to

/home/scripts/test.php

But a '500 Internal Server Error' is returned if you try going to domain.com/test.php

I tried chown'ing the test.php file to the user as well a assigning it full permissions (777) but still no go.

Symbolic links to HTML files work fine though.

Is this standard suPHP behavior, and if so, any way around this?
 

jdlightsey

Perl Developer III
Staff member
Mar 6, 2007
126
2
243
Houston Texas
cPanel Access Level
Root Administrator
If there are any symlinks involved in the path to a script, suPHP will check the original path you supplied and the real non-symlinked path to the file. Every directory along those paths 1) can only be owned by root or the user executing the script, 2) can't be group or other writable, 3) must be traversable by the user.
 

babakb

Well-Known Member
Jan 20, 2007
47
0
156
All three conditions are met and yet no go. Case in question:

>> ls -l /home/rfless/public_html/ | grep test

-rwxr--r-- 1 rfless rfless 20 Apr 25 12:33 test.php
lrwxrwxrwx 1 root root 8 Apr 25 12:33 test_symlink.php -> test.php
Both the actual and symlink files reside in the same folder, test.php is owned by actual user and is neither group or world writable.

www.domain.com/test.php works but www.domain.com/test_symlink.php gives '500 internal server error'
 
Last edited:

sparek-3

Well-Known Member
Aug 10, 2002
2,059
236
368
cPanel Access Level
Root Administrator
The symlink is owned by root, not rfless.

You will need to change the ownership of the symlink to rfless:

Code:
chown -h rfless:rfless test_symlink.php