Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Nov 2010
    Posts
    9

    Unhappy open_basedir restriction in effect, but is disabled

    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. #2
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: open_basedir restriction in effect, but is disabled

    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.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  3. #3
    Member
    Join Date
    Nov 2010
    Posts
    9

    Default Re: open_basedir restriction in effect, but is disabled

    Hi, and thank you for answering so quick.

    Quote Originally Posted by cPanelTristan View Post
    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.
    I have only edited the username. The error-message actually says the path is (0).

    Quote Originally Posted by cPanelTristan View Post
    Next, what are the permissions settings on the file being included?
    All of the files are owned by username:username, and has permissions set to -rw-r--r--.

    Quote Originally Posted by cPanelTristan View Post
    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.
    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 Code:
    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

  4. #4
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: open_basedir restriction in effect, but is disabled

    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.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  5. #5
    Member
    Join Date
    Nov 2010
    Posts
    9

    Default Re: open_basedir restriction in effect, but is disabled

    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. #6
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: open_basedir restriction in effect, but is disabled

    You are very welcome and sorry we couldn't get the script itself working. Good luck
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

Similar Threads & Tags
Similar threads

  1. open_basedir restriction in effect.
    By Guda in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 06-23-2008, 08:34 PM
  2. After transfer backups I got open_basedir restriction in effect.
    By esupport.org.ua in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 07-08-2005, 07:08 AM
  3. Warning: open_basedir restriction in effect
    By Ver17 in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 05-28-2005, 08:47 AM
  4. open_basedir restriction in effect.
    By melvinmeow in forum New User Questions
    Replies: 0
    Last Post: 04-09-2005, 02:31 PM
  5. Error: open_basedir restriction in effect
    By Jeff75 in forum cPanel and WHM Discussions
    Replies: 17
    Last Post: 01-29-2004, 07:18 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube