Page 1 of 1

how fix open_basedir issue

Posted: Wed Nov 27, 2013 3:43 am
by blogt
Hi

I have loged error

[26-Nov-2013 08:28:46 UTC] PHP Warning: require(): open_basedir restriction in effect. File(/class/class.rewrite.php) is not within the allowed path(s): (/home/admin/domains/mydomain.com/public_html/:/tmp:/var/tmp:/usr/local/lib/php/:/home/admin/domains/mydomain.com/public_html/blog/) in /home/admin/domains/mydomain.com/public_html/blog/widget/index.php on line 10

How I should fix issue?

Re: how fix open_basedir issue

Posted: Wed Nov 27, 2013 3:53 am
by requinix
Seems like you have a

Code: Select all

require("/class/class.rewrite.php");
when you should have a

Code: Select all

require($_SERVER["DOCUMENT_ROOT"] . "/class/class.rewrite.php");
The key point is the use of DOCUMENT_ROOT. Without it, "/class/class.rewrite.php" means to look in the class folder in the root of the filesystem, which isn't allowed (hence the error) but not even what you want in the first place.

Re: how fix open_basedir issue

Posted: Wed Nov 27, 2013 4:18 am
by blogt
on line 10 I have this code:

require ($_SERVER["DOCUMENT_ROOT"]."/class/class.rewrite.php");

Re: how fix open_basedir issue

Posted: Wed Nov 27, 2013 3:54 pm
by requinix
Does it have a value?

Code: Select all

print_r($_SERVER);
DOCUMENT_ROOT looks like it is supposed to be /home/admin/domains/mydomain.com/public_html.

While you're in there, see if anything else looks wrong.