recently, the hosting svc where i maintain several php apps changed the default php machinery from php4 to php5. the change was made without warning or notification. using cpanel, i switched back to php4, but now (among other things) there is an occasional error:
> Warning: Unknown(): open_basedir restriction in effect.
> File(/home/mydomain/public_html/xyz/customer/addClient.php)
> is not within the allowed path(s):
> (/home/myeasyar/:/usr/lib/php:/usr/php4/lib/php:...:/tmp) in
> Unknown on line 0
note that the file php is trying to load is in /home/mydomain, yet the allowed path contains /home/myeasyar (presumably another customer's domain on the same host).
the error happens on random pages at random times, and is quite difficult to reproduce. yet, it's frequent enough to annoy my customers.
the pages are internal applications at the customers businesses and therefore, i can't just let tech support go randomly running scripts. i have offered to produce a script for them, but it would require them to sit at a browser for hours trying to recreate the problem, and then, only produce an error msg. again, the error isn't "in" a script, it's loading the script. i haven't seen evidence of php cron scripts having this issue, but there's no guarantee one way or the other.
tech support doesn't seem to know how to fix this, so i thought i'd ask a larger audience.
php on this machine (as far as i can tell) runs php4 OR php5, not both. the version is 4.4.9 and apache is 2.2.11 runing on linux 2.6.9-42.0.3.ELsmp.
i have already started changing the code to be php5. the changes aren't that massive, but the testing effort is another story. and, i guess, changing to php5 doesn't necessarily guarantee the problem will go away, but i think it's prob'ly the right thing to do. sigh...
and changing hosts is something i'd like to avoid - even tho there are occasional snafus like this, my experience with them is still a net positive.
did i mention time is of the essence?
by: fiboPosted on 2009-08-07 at 08:24:51ID: 25043755
OK.
en/ini.sec t.safe-mod e.php#ini. open- based ir for a correctly worded explanation.
/xyz/custo mer/ to the include path en/functio n.set-incl ude-path.p hp l/xyz/cust omer/'; de_path() . ':' . $path);
Just some random thoughts, because you have lots of information.
1 - The provider changed to php5. In order to do that, they probably had some changes to do in php configuration files, now sure how this impacts you.
2 - One major change, as far as I remember, is that you now have "open_basedir restriction"
See http://www.php.net/manual/
To summarize: when this restriction is active, the file canNOT be opened unless it is directly in a directory placed in tree under the include path AND the directory where the php script is run from. In shared servers, this is one way to avoid php scripts (but alas, only them!) to access files out of the usual allowed places.
3 - What you can do.
In your case, it seems to be a "library" type of problem (vs a "data" type), so you should probably add /home/mydomain/public_html
see http://www.php.net/manual/
Try the effect of
$path = '/home/mydomain/public_htm
set_include_path(get_inclu