php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34656 open_basedir restriction in effect although paths are set correctly
Submitted: 2005-09-27 12:44 UTC Modified: 2005-12-14 06:29 UTC
Votes:14
Avg. Score:4.6 ± 0.6
Reproduced:14 of 14 (100.0%)
Same Version:10 (71.4%)
Same OS:7 (50.0%)
From: wolfram at schlich dot org Assigned:
Status: Closed Package: Safe Mode/open_basedir
PHP Version: 4.4.1 OS: Linux 2.2.16 i586
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: wolfram at schlich dot org
New email:
PHP Version: OS:

 

 [2005-09-27 12:44 UTC] wolfram at schlich dot org
Description:
------------
Warning: touch(): open_basedir restriction in effect. File(/tmp/f5_test) is not within the allowed path(s): (/home/sites/site15/:/tmp) in /home/sites/site15/web/write_tmp.php on line 3

Warning: fopen(): open_basedir restriction in effect. File(/tmp/f5_test) is not within the allowed path(s): (/home/sites/site15/:/tmp) in /home/sites/site15/web/write_tmp.php on line 4

Warning: fopen(/tmp/f5_test): failed to open stream: Operation not permitted in /home/sites/site15/web/write_tmp.php on line 4

Warning: fwrite(): supplied argument is not a valid stream resource in /home/sites/site15/web/write_tmp.php on line 5

Warning: fclose(): supplied argument is not a valid stream resource in /home/sites/site15/web/write_tmp.php on line 6

Reproduce code:
---------------
--8<--[ write_tmp.php ]--8<--
<?php
$tmpfile = "/tmp/f5_test";
touch($tmpfile);
$fp = fopen("$tmpfile","w");
fwrite($fp, "test ....");
fclose($fp);
?>
--8<--[ httpd.conf ]--8<--
<DirectoryMatch "/home/sites/site15/">
## doesn't work
php_admin_value open_basedir /home/sites/site15/:/tmp
## also doesn't work
# php_admin_value open_basedir /
## works, but is not what's desired
# php_admin_value open_basedir none
</DirectoryMatch>
--8<--
Also tried to set open_basedir within the VirtualHost, didn'
t work either.

Expected result:
----------------
no errors

Actual result:
--------------
open_basedir errors

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-01 15:01 UTC] wolfram at schlich dot org
Just tried with the freshly released 4.4.1, without luck:
--8<--
Warning: fopen(): open_basedir restriction in effect. File(/tmp/foo.bar) is not within the allowed path(s): (/home/sites/site81/:/tmp/:/usr/share/pear/) in /home/sites/site81/web/fopen.php on line 3

Warning: fopen(/tmp/foo.bar): failed to open stream: Operation not permitted in /home/sites/site81/web/fopen.php on line 3
--8<--

--8<--[ access.conf ]--8<--
<DirectoryMatch "/home/sites/site81/">
php_admin_value open_basedir /home/sites/site81/:/tmp/:/usr/share/pear/
</DirectoryMatch>
--8<--
 [2005-11-01 22:34 UTC] sniper@php.net
Does it work if you set the open_basedir in php.ini ?

 [2005-11-25 13:27 UTC] wolfram at schlich dot org
just tried http://snaps.php.net/php4-STABLE-200511251208.tar.gz with open_basedir in php.ini -- no luck:

Warning: touch(): open_basedir restriction in effect. File(/tmp/f5_test) is not within the allowed path(s): (/tmp/) in /home/sites/site15/web/write_tmp.php on line 3
 [2005-11-30 15:02 UTC] wolfram at schlich dot org
Do you need more information?
 [2005-12-13 17:41 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip


 [2005-12-13 18:00 UTC] wolfram at schlich dot org
Unfortunately it's impossible to use any other version of PHP than 4.x on this machine :-(
 [2005-12-13 20:16 UTC] sniper@php.net
I didn't ask you to permanently install it, I only asked you to TRY it out and see if you can reproduce it.
 [2005-12-13 22:00 UTC] wolfram at schlich dot org
I cannot even try it.
 [2005-12-14 06:29 UTC] sniper@php.net
We really don't support PHP 4 anymore. If you don't test with PHP 5, we consider the bug fixed there.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jan 17 21:01:28 2025 UTC