Results 1 to 6 of 6
  1. #1

    PHP not working in subdomain

    I'm having a problem with a subdomain account. I'm trying to run a simple phpinfo file, but it's returning a warning:
    Warning: Unknown(): open_basedir restriction in effect. File(/home/subdomain/public_html/info.php) is not within the allowed path(s): (/home/domain/:/usr/lib/php:/usr/local/lib/php:/usr/bin:/usr/sbin:/tmp) in Unknown on line 0

    Warning: Unknown(/home/subdomain/public_html/info.php): failed to open stream: Operation not permitted in Unknown on line 0

    Warning: (null)(): Failed opening '/home/subdomain/public_html/info.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in Unknown on line 0
    Please note the words I have bolded. Both the domain and the subdomain have folders in the "home" directory. Why would a basic php file be directed to a different directory than the one in which it is located? Is this a problem with the php installation or permissions? Safe Mode is off. Open_basedir is showing "no value." There is a module called "mod_security," could it have an incorrect setting?

    I hope someone can help me or direct me to an answer for this. I've contacted my host, but so far, I'm not sure they understand I'm not asking for permission to access the main domain's directories or files. I just want php to work in the subdomain's directories.

    Thank you for any help you can give.

  2. #2
    Join Date
    Apr 2002
    Posts
    930
    How did you create the subdomain? Is the subdomain a whole other account?

  3. #3
    Join Date
    May 2003
    Posts
    472
    Your getting this because your host has open_basedir protection on. That makes it so you cannot open any files outside your home directory. I dont know why you would be doing that though. Ask the host if they can exclude you from the open_basedir restriction.

    This is not a side-effect of mod_security.

  4. #4
    Thanks for the replies, but it's still not "making sense" to me.

    The subdomain is a completely separate account (with its own cpanel and everything). I would think this would mean the subdomain's "home directory" isn't the top-level domain's "home directory," so the phpinfo file should work.

    subdomain's path:
    /home/subdomain/public_html/

    domain's path:
    /home/domain/public_html/

    Why is php acting like I'm trying to open a file in a different directory? Why isn't php available in my subdomain's home directory? Even if open_basedir protection is on, the file is in the correct directory, so there should be no problem.

    Is open_basedir supposed to take away the ability to use php from all subdomains? Gad, that's some security.

  5. #5
    Join Date
    Apr 2002
    Posts
    930
    A subdomain, generally, is considered to be part of another domain. So if you have domain.com with a document root of:

    /home/domain/public_html

    Then a subdomain, such as subdomain.domain.com would have a document root of:

    /home/domain/public_html/subdomain

    Atleast this is how I view subdomains. Yes, what you have could be considered a subdomain, and I guess it really is by definition, but in the hosting industry (atleast in my experience) the above is more of a subdomain than creating a whoe seperate account.

    When you created a seperate account, you created a whole different directory structure:

    /home/subdomain/public_html

    With open_basedir enabled, you can only access /home/subdomain and below. Since you are wanting to access /home/domain that is in a seperate part of the /home partition and is inaccessible. Again, like suggested earlier, if you want to keep your current set up you will need to ask your host to disable open_basedir for your subdomain account.

  6. #6
    Originally posted by SPaReK
    With open_basedir enabled, you can only access /home/subdomain and below. Since you are wanting to access /home/domain that is in a seperate part of the /home partition and is inaccessible. Again, like suggested earlier, if you want to keep your current set up you will need to ask your host to disable open_basedir for your subdomain account.
    I don't want to access to /home/domain/. That's my point. The only directories I care about are the subdomain's directories. For whatever reason, php is ignoring that the "subdomain" is completely separate from the "domain," and I would like to know why and get it fixed.

    Thank you for the reply, I do appreciate you trying to help. I don't know how much clearer I can explain the problem. This is getting frustrating. I have even recreated the setup on a different server with a different domain and a separate subdomain account. The phpinfo file works just fine in the subdomain account on this other server, despite having the same "open_basedir" setting of "no value" as my account with the problem.

    If for some reason, you still believe I'm trying to access a file in the top-level domain's directories, please explain why you think this. Perhaps I don't understand how that simple php file works - though it works in that other subdomain.

    Note: The reason I keep repeating the question is my hosting company has already said they won't remove the open_basedir restriction. No big deal, since I don't think that is the actual problem here.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •