#22309 [Opn->Fbk]: open_basedir: strange problems
| From: | sniper@php.net | Date: | Thu, 20 Feb 2003 04:01:52 +0000 |
| Subject: | #22309 [Opn->Fbk]: open_basedir: strange problems | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-33620@lists.php.net to get a copy of this message | ||
ID: 22309
Updated by: sniper@php.net
Reported By: Joerg dot Dieter dot Friedrich at uni-konstanz dot de
-Status: Open
+Status: Feedback
Bug Type: *Directory/Filesystem functions
Operating System: Solaris 8
PHP Version: 4.3.1
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
And are you setting open_basedir in httpd.conf??
As you can see, the setting seems to get reset at
some point.
Previous Comments:
------------------------------------------------------------------------
[2003-02-19 17:41:47] Joerg dot Dieter dot Friedrich at uni-konstanz
dot de
Hi!
First I know that there are a lot of different bugs concerning
open_basedir, and I read recent ones, about 20. But this is all
strange.
Second: My system is a Sparc U10
Solaris 8 based.
Apache 1.3.27 and PHP4.3.1
This is my test system for out Webmailservice.
ATM there is a Horde-1.2.8/imp2.2.8 installed which is a identical copy
from our working production system. This is in docroot of the apache.
(Filesystem location: /opt/horde/htdocs/horde/imp). php.ini hase a
include_path to /opt/horde/phplib, and the auto_prepend_file statement
for phplib. open_basedir is set to
".:/opt/php4/lib/php:/opt/horde2test:/var/tmp/ldapcache:/opt/horde:/var/webmail-attachments"
We are in the transition to Horde2.2.1/imp3.1.
I installed the new system into /opt/horde2test and
made an alias in apache's httpd.conf to https://<server>/imp3test and
set via php_admin_value the prepend file to none and the include-path
to php4.3.1/pear-directory. This is all still working fine.
But we have a small and dirty hack within the old horde/imp combo which
is needed to get the userid from a ldapserver. The users have to use
their mail-alias to login, but for the connection to the imapserver the
userid is required. Our piece of code does only some ldap-queries and
then tries to store the result in a file to speed up next login.
and the code to write these small files is this:
$pfad="/tmp/ldapcache/".$buchstabe1."/".$buchstabe2;
$filename=$pfad."/".$imp['user'];
$command="mkdir -m 0700 -p ".$pfad;
exec($command);
$fd=fopen($filename,"w");
fwrite($fd,$imp['unipopid']); fwrite($fd,"\n");
fclose($fd);
In Horde1/imp2 there is no error the files are created.
In Horde2/imp3 I always get:
[19-Feb-2003 21:06:37] PHP Warning:fopen()]: open_basedir restriction
in effect. File(/tmp/ldapcache/j/f/joerg.dieter.friedrich) is not
within the allowed path(s): (.) in
/opt/horde2test/htdocs/horde/imp/lib/IMP.php on line 166
[19-Feb-2003 21:06:37] PHP Warning:
fopen(/tmp/ldapcache/j/f/joerg.dieter.friedrich): failed to create
stream: Not owner in /opt/horde2test/htdocs/horde/imp/lib/IMP.php on
line 166
[19-Feb-2003 21:06:37] PHP Warning: fwrite(): supplied argument is not
a valid stream resource in /opt/horde2test/htdocs/horde/imp/lib/IMP.php
on line 167
[19-Feb-2003 21:06:37] PHP Warning: fwrite(): supplied argument is not
a valid stream resource in /opt/horde2test/htdocs/horde/imp/lib/IMP.php
on line 167
[19-Feb-2003 21:06:37] PHP Warning: fclose(): supplied argument is not
a valid stream resource in /opt/horde2test/htdocs/horde/imp/lib/IMP.php
on line 168
If I use the older horde/imp on the _same_ machine with the _same_
apache/php there is no problem the file is created.
And to be more funny: /tmp is a symlink to /var/tmp
If i change the line
$pfad="/tmp/ldapcache/".$buchstabe1."/".$buchstabe2;
to
$pfad="/var/tmp/ldapcache/".$buchstabe1."/".$buchstabe2;
everything works as expected.
And now I do not know what to do?
What can cause such strange effects?
To be honest I hesitate to go productional with such a system if I
cannot be sure that its working as it should.
Yours Joerg
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22309&edit=1