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.
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.
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.
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.
A subdomain, generally, is considered to be part of another domain. So if you have domain.com with a document root of:
Then a subdomain, such as subdomain.domain.com would have a document root of:
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:
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.
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.