Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    May 2009
    Location
    England
    Posts
    22

    Default include PHP script from under the user directory

    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?
    Lamped.co.uk Web Development

  2. #2
    BANNED
    Join Date
    Jun 2005
    Location
    Wild Wild West
    Posts
    2,025

    Default

    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. #3
    Member
    Join Date
    May 2009
    Location
    England
    Posts
    22

    Default

    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"
    Lamped.co.uk Web Development

  4. #4
    Member
    Join Date
    May 2009
    Location
    England
    Posts
    22

    Default

    Just double-checked EasyApache, and I don't have mod SuPHP compiled in. Should I rebuild with that?
    Lamped.co.uk Web Development

  5. #5
    Member
    Join Date
    Aug 2004
    Posts
    472

    Default

    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.
    www.cliffsupport.com
    i WebManager | Access WHM from your iPhone

Similar Threads & Tags
Similar threads

  1. Create a user account with PHP (script)?
    By MrLeN in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 12-19-2010, 12:27 PM
  2. email forwarding to script forcing user directory
    By schwim in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 06-05-2010, 03:20 PM
  3. What Log can I look in to see how a user uploaded a php script
    By romanus in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 11-01-2006, 11:54 PM
  4. Running php script as another user
    By ircmaxell in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 07-20-2006, 10:33 AM
  5. php - include cgi script
    By typer in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 04-30-2003, 11:12 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube