Hello!
There's a website with a following structure
index.php in the site's DocumentRoot directory (for this thread, let's
call it /www)
functions.php, init.php and db_connect.php in /www/library
index.php includes line:
include_once('library/functions.php');
functions.php includes lines:
include_once('db_connect.php');
include_once('init.php');
The website was running fine under PHP 4.4.0 installed as Apache module.
Then we tried it with PHP 5.0.5 installed as CGI. We got the following
errors:
PHP Warning: main() : open_basedir restriction in effect.
File(/db_connect.php) is not within the allowed path(s):
(/www:/usr/local/www/phpMyAdmin:/var/tmp/php) in
/www/library/functions.php on line 2
PHP Warning: main(db_connect.php) : failed to open stream: Operation
not permitted in /www/library/functions.php on line 2
PHP Warning: main() : Failed opening 'db_connect.php' for inclusion
(include_path='.:') in /www/library/functions.php on line 2
...and similar 3 messages about init.php.
Note that first warning is about '/db_connect.php', not 'db_connect.php'
or './db_connect.php'. /www/library should be inside the open_basedir,
since it is under /www, which is listed in open_basedir in php.ini. It
looks like something is changed in PHP's behaviour between versions 4
and 5 or is differently handled in CGI vs Apache SAPI, but I find it
unlikely since I can find no documentation regarding this. It's more
likely that I am overlooking something trivial, but I can't figure out
what it is.
I tried to change the include lines to
include_once('./db_connect.php');
include_once('./init.php');
but this made no difference.
However, when I specify the full path:
include_once('/www/library/db_connect.php');
include_once('/www/library/init.php');
then the errors disappear and 'everything' seems to work.
Also, I never get any errors about the
include_once('library/funcions.php');
line in index.php
I'm puzzled...
--
... ASCII stupid question, get a stupid ANSI!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php