The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

suPHP and PHP script symbolic links

Discussion in 'General Discussion' started by babakb, Apr 25, 2008.

  1. babakb

    babakb Well-Known Member

    Joined:
    Jan 20, 2007
    Messages:
    47
    Likes Received:
    0
    Trophy Points:
    6
    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?
     
  2. jdlightsey

    jdlightsey Perl Developer III
    Staff Member

    Joined:
    Mar 6, 2007
    Messages:
    126
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    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.
     
  3. babakb

    babakb Well-Known Member

    Joined:
    Jan 20, 2007
    Messages:
    47
    Likes Received:
    0
    Trophy Points:
    6
    All three conditions are met and yet no go. Case in question:

    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'
     
    #3 babakb, Apr 25, 2008
    Last edited: Apr 25, 2008
  4. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,384
    Likes Received:
    23
    Trophy Points:
    38
    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
     
Loading...

Share This Page