|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-07-15 00:39 UTC] phynias at camphreaks dot com
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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 05:00:02 2025 UTC |
use absolute path with include() and all other functions. define('ROOT_PATH','/home/httpd/vhosts/mysite.com/httpdocs'); include (ROOT_PATH.'/inc/include1.php'); it will work perfectly at all hostings, all platforms, all versions etc. etc.