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.

open_basedir restriction in effect, but is disabled

Discussion in 'General Discussion' started by AudunS, Jan 30, 2011.

  1. AudunS

    AudunS Member

    Joined:
    Nov 11, 2010
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Hello everyone.

    I got a problem that I just can't figure out.

    I've got a cPanel server running with several users, all working fine. To be able to run a script on multiple sites, I've set PHP to run as CGI. This is all working fine.

    But a new customer has some custom software, and it just won't work.

    The warning comes from open_basedir:

    Warning: require_once() [function.require-once]: open_basedir restriction in effect. File(/home/the_username/public_html/some/file.php) is not within the allowed path(s): (0) in [...]

    I'm not sure what the problem is. The "allowed path(s)" is apparently empty (0), and open_basedir is disabled under "PHP open_basedir Tweak". I didn't think open_basedir would work when running PHP CGI?

    Is there a problem with my customers software? I only get this error in this site, everything else is working fine.

    EDIT: the index.php-file in /home/username/public_html/ is including a file from "subfolder/" (/home/username/public_html/subfolder)
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello,

    We are going to need to see the section of code that is calling this error if that is available. Also, no part of the error message other than the username has been modified, right? Meaning the end port where it has "(0) in [...]" is exactly how the error appears? We need the full error message or messages if possible with only the username changed to minimize possible issues with modifying the error message making it difficult to troubleshoot effectively.

    Next, what are the permissions settings on the file being included?

    Finally, have you tried copying the custom script to another account to see if it has the same issue such as a test account? Just to ensure the user hasn't modified some setting on their account that might be causing it? People can actually setup individual php.ini files and change settings under CGI, although it isn't as straightforward to do so (as it is under suPHP anyway). I cannot discount the possibility that the user setup their own php.ini to work under CGI and didn't change some setting that is causing this to happen.

    Thanks.
     
  3. AudunS

    AudunS Member

    Joined:
    Nov 11, 2010
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Hi, and thank you for answering so quick.

    I have only edited the username. The error-message actually says the path is (0).

    All of the files are owned by username:username, and has permissions set to -rw-r--r--.

    I've checked the settings for the user, and I can't see any changes. And if the user made a change to it's own php.ini, the file would be created inside the home directory somewhere? Because there is no php.ini..

    The code

    PHP:
    define ('dir_root''/home/username/public_html');
    require 
    'include/somefile.php';
    require_once 
    'include/someotherfile.php';
    Seems like normal require/include-code to me...

    The problem might be in the customers code (can you define basedir-options directly in php?), but I want to figure this out fast, and hopefully rule out any error on our side :p
     
  4. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    I'd take the script and test it on another account. You may want to not define the root path in the code in the first line provided (comment out that line), then simply put the full absolute path for the require and require_once statements to see the results.
     
  5. AudunS

    AudunS Member

    Joined:
    Nov 11, 2010
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Allright, I've just created a new user, and copied the files - and I still get the exact same error.

    I think this is a script-problem, and I don't think that this is related to the configuration on the server. When I try to include other files than the original files in the scripts, there is no errors.

    Thank you very much for your help!
     
  6. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    You are very welcome and sorry we couldn't get the script itself working. Good luck :)
     
Loading...

Share This Page