Open_basedir Restriciton while hosting subdomain outside root folder

494 Views Asked by At

Ok my home directory is /home/tubzandm

My root folder for the live site is /home/tubzandm/public_html

Our development site is /home/tubzandm/develop/public_html

Domain dev.tubzandmore.com points to /home/tubzandm/develop/public_html

Domain cp.dev.tubzandmore.com points to /home/tubzandm/develop/public_html/cp

When my scripts hosted at cp.dev.tubzandmore.com try to call a require_once, I get:

Warning: require_once() [function.require-once]: open_basedir restriction in effect. File(/home/tubzandm/develop/public_html/includes/mainlib.inc) is not within the allowed path(s): (/home/tubzandm/develop/public_html/cp:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/tubzandm/develop/public_html/cp/lib/functions.php on line 4

The code in functions.php on line 4 says

require_once('/home/tubzandm/develop/public_html/includes/' . 'mainlib.inc');

We use Apache DSO style directives.

Granted I can go into PHP open_basedir Tweak and disable protection for that domain name. But our project manager is very picky about security and doesnt want us to.

Does anyone know of a workaround? Or a good explination as to why we SHOULDNT have open_basedir protection?

mainlib.inc is in /home/tubzandm/develop/public_html/includes. I get the error when I try to require that from inside functions.php which is in /home/tubzandm/develop/public_html/cp/lib

2

There are 2 best solutions below

0
On

Disabled open_basedir for this domain and it worked. Not happy with that but it seems to be only workable solution

2
On

Don't you think this

require_once('/home/tubzandm/develop/public_html/includes/' . 'mainlib.inc');

should be

require_once('/home/tubzandm/develop/public_html/cp/includes/' . 'mainlib.inc');?

as you said that your cp.dev.tubzandmore.com domain is pointed to /home/tubzandm/develop/public_html/cp