From:             phynias at camphreaks dot com
Operating system: Redhat 9
PHP version:      5.0.0
PHP Bug Type:     PHP options/info functions
Bug description:  problem with open_basedir and include

Description:
------------
When open_basedir options or set on a a set within apache.
Such as:
php_admin_value open_basedir"/home/httpd/vhosts/mysite.com/httpdocs"

If I do an include form 1 page and then in that page inlcude another page
it errors out with 
open_basedir restriction in effect.

Easiest way to test it is to do the following.
in your docroot create a file called test.php inside test.php put <?
include('inc/include1.php');?>
then inside include1.php put
<? include('inc2/include2.php'); ?>
and inside include2.php put
<? print "hello world"; ?>

So if yer vase was /httpd/docroot you would have

/httpd/docroot/test.php
/httpd/docroot/inc/include1.php
/httpd/docroot/inc/inc2/include2.php

Then bring up test.php in your browser.


Of course u must have the dirs /inc and inc/inc2 created
This will include the first file but error on the second one.

Actual result:
--------------
Warning: main() [function.main]: open_basedir restriction in effect.
File(/usr/share/pear/include/inc2.php) is not within the allowed path(s):
(/home/httpd/vhosts/mysite.com/httpdocs:/tmp) in
/home/httpd/vhosts/mysite.com/httpdocs/test/inc.php on line 2

Warning: main(include/inc2.php) [function.main]: failed to open stream:
Operation not permitted in
/home/httpd/vhosts/mysite.com/httpdocs/test/inc.php on line 2

Warning: main() [function.include]: Failed opening 'include/inc2.php' for
inclusion (include_path='.:./:/usr/share/pear:/php/includes:') in
/home/httpd/vhosts/mysite.com/httpdocs/test/inc.php on line 2

-- 
Edit bug report at http://bugs.php.net/?id=29170&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29170&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29170&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29170&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29170&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29170&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29170&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29170&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29170&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29170&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29170&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29170&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29170&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29170&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29170&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29170&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29170&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29170&r=float

Reply via email to