Re: open_basedir not working on FreeBSD

From: Date: Fri, 23 Aug 2002 17:40:19 +0000
Subject: Re: open_basedir not working on FreeBSD
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-87356@lists.php.net to get a copy of this message
Hi Matt, Thanks for catching this one - I've just checked the one-line fix into cvs; main/main.c is the file that was changed. --Wez. On 08/23/02, "Matt Haught" <haughtlists@hotmail.com> wrote: > Hello, > > Open_basedir does not seem to be working properly for me on my FreeBSD > servers. Reading files from outside the open_basedir is successfull for > both include() and readfile(), but fails (as it should) when trying to do > the same with fopen or opendir and gives the "Warning: open_basedir > restriction in effect. File is in wrong directory in > /home/www/websites/htdocs/info.php on line 10" error. I am using FreeBSD > 4.4-RELEASE/apache-1.26, 4.6-RELEASE/apache-1.26, and > 4.6.2-RELEASE/apache-1.27-dev and they are all using a fresh cvs of php4 > from Aug 21-23. I am reading /etc/resolv.conf to test the servers, and all > of them have their open_basedir set to "/home/www/websites/htdocs/" or > "/websites/" for the testing. Am I missing something. Could someone else > using FreeBSD/open_basedir test this out for me? My > WinXP/apache-1.26/php-4.2.2 development box does not seem to have this > problem. > > Here is my test file: > <?php > $testfile='/etc/resolv.conf'; > $testdir='/etc'; > echo 'include(): '; > include($testfile); > echo '<br>'; > > echo "fopen()/fread(): "; > if ($fd = fopen ($testfile, "r")) { > echo fread ($fd, filesize ($testfile)); > } > echo '<br>'; > > echo 'readfile(): '; > echo readfile($testfile); > echo '<br>'; > > echo 'opendir()/readdir(): '; > if ($handle = opendir($testdir)) { > echo "Directory handle: $handle<br>"; > echo "Files:<br>"; > > /* This is the correct way to loop over the directory. */ > while (false !== ($file = readdir($handle))) { > echo "$file<br>"; > } > } > echo '<br>'; > phpinfo(); > ?> > > _________________________________________________________________ > Send and receive Hotmail on your mobile device: http://mobile.msn.com > > > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.dev (#87356) next »