#22101 [Com]: Wrong behaviour of open_basedir restriction

From: Date: Fri, 23 Apr 2004 17:32:02 +0000
Subject: #22101 [Com]: Wrong behaviour of open_basedir restriction
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-58667@lists.php.net to get a copy of this message
ID: 22101 Comment by: fnatter at gmx dot net Reported By: cmouse at quakenet dot org Status: Bogus Bug Type: Scripting Engine problem Operating System: Debian linux 2.4.19 PHP Version: 4.3.0 New Comment: as an improvement for the second solution, you should use dirname(__FILE__) instead of hard-coding the path. Previous Comments: ------------------------------------------------------------------------ [2004-03-15 09:30:32] fnatter at gmx dot net I have a workaround: put the full path to the include-directory (i.e. /home/m2004001/Test/tmp/ in my test-case) in include_path: 1. put this in the <VirtualHost> of the affected domain: php_admin_value include_path /home/m2004001/Test/tmp:.:/usr/share/pear 2. or create one include-file that gets included first, like this: $incpath = ini_get("include_path"); ini_set("include_path", "/home/m2004001/Test/tmp:$incpath"); ------------------------------------------------------------------------ [2004-03-12 09:29:47] fnatter at gmx dot net I am having the same problem with php 4.1.2 (Debian 3.0), but with open_basedir != "/": here is my test-case (with php_admin_value open_basedir /home/m2004001): /home/m2004001/Test/test1.php: <?php echo "test1"; include("tmp/test2.php"); ?> /home/m2004001/Test/tmp/test2.php: <?php echo "test2"; include("test3.php"); ?> /home/m2004001/Test/tmp/test3.php: <?php echo "test3"; ?> now load test1.php in the browser and you get: Warning: open_basedir restriction in effect. File is in wrong directory in /home/m2004001/Test/tmp/test2.php on line 3 In my project I have all my include files in app/include, and when I include another include-file in an include-file I omit the path (as in the example above). It works when I use absolute paths in include, but I don't want to specify a path involving the DocumentRoot (in case it gets moved), so is there another workaround? thanks, ------------------------------------------------------------------------ [2003-02-13 20:43:28] r at phid dot ae I had the same problem and I was just about to submit a bug because upgrading from 4.2.3 to 4.3.0 breaks any vhosts that have open_basedir "/". Maybe it's an idea to update the documentation to reflect that 'none' can be used to override a restrictive default? -- raphidae <root@mediamonks.net> ------------------------------------------------------------------------ [2003-02-13 13:18:26] d-e-a-t-h at gmx dot net Hm. It's not only the root-dir (/). It doesn't work in other directories, either. e.g. my customer has a www-dir with hundrets of subdirectories. No Problem in 4.1.2! I had only to 'php_admin_flag open_basedir "/home/customer/www"'. Now with PHP 4.3.0 I have to include each subdir and its subdirs which brings me a lot of work. Sorry for bad engl. Greets Stefan ------------------------------------------------------------------------ [2003-02-13 00:51:38] cmouse at quakenet dot org Sometimes there is... I only use open_basedir / (formerly though, now it's none) in apache configuration, since phpSysInfo needs to access few places outside the normal basedir /www. But *shrug* none seems to work, which it didn't do on the prev. version I had, 4.1.2 ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/22101 -- Edit this bug report at http://bugs.php.net/?id=22101&edit=1

« previous php.bugs (#58667) next »