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.

include PHP script from under the user directory

Discussion in 'Security' started by LampedWeb, Jul 14, 2009.

  1. LampedWeb

    LampedWeb Member

    Joined:
    May 28, 2009
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    England
    cPanel Access Level:
    Root Administrator
    I want

    /home/someapi
    /home/useraccount

    include('/home/someapi/somescript.php');

    or

    include('somescript.php');

    usable from all accounts while keeping basic security so that users can't access files inside other users directories.

    If it helps, I own the VPS.

    Any ideas?
     
  2. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    That's not an issue if you run PHP as SuPHP!

    If you run PHP as DSO (Apache Module) then you have php_openbasedir
    available to you which is designed specifically to help with that and you
    just need to go in and enable that from the "Security Center" menu in WHM!
     
  3. LampedWeb

    LampedWeb Member

    Joined:
    May 28, 2009
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    England
    cPanel Access Level:
    Root Administrator
    What I've done:

    Gone into the PHP config screen and set open_basedir to "/home/mai_api/" (without quotes),

    Gone into the security center, "Tweak PHP open_basedir Security" and enabled it (oops, that should have been enabled already...),

    Put a test.php in /home/mai_api/test.php and tried calling it from a user account. It still says "open_basedir restriction in effect. File(/home/mai_api/test.php) is not within the allowed path"
     
  4. LampedWeb

    LampedWeb Member

    Joined:
    May 28, 2009
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    England
    cPanel Access Level:
    Root Administrator
    Just double-checked EasyApache, and I don't have mod SuPHP compiled in. Should I rebuild with that?
     
  5. david510

    david510 Well-Known Member

    Joined:
    Aug 22, 2004
    Messages:
    473
    Likes Received:
    0
    Trophy Points:
    16
    Since the error us popping up, open_basedir protection is there. Add the path to the VH section in the httpd.conf file for the corresponding domain.
     
Loading...

Share This Page