php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40141 open_basedir vs. tmpfile()
Submitted: 2007-01-16 01:13 UTC Modified: 2010-02-25 14:10 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: flobee at gmail dot com Assigned:
Status: Closed Package: *Directory/Filesystem functions
PHP Version: 5.2.0 OS: debian etch
Private report: No CVE-ID:
 [2007-01-16 01:13 UTC] flobee at gmail dot com
Description:
------------
using php_admin_value open_basedir "/home/somthing/" in vhosts i get problems to run the function tmpfile()


vhost setting:
 php_admin_value open_basedir "/home/somthing/:/tmp/"

or tested with ... does the same error:
 php_admin_value open_basedir "/home/somthing/"



without open_basedir the function works like expected :-/

Reproduce code:
---------------
<?php
// --- tests -----------------------------------------------------------
<?php
$temp = tmpfile();
fwrite($temp, "writing to tempfile");
fseek($temp, 0);
echo 'x:'.fread($temp, 1024);
fclose($temp); // this removes the file
//----------------------------------------------------------------------
?>

Actual result:
--------------
Warning: tmpfile() [function.tmpfile]: open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/home/abc/:/tmp/) in index.php on line 123

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-16 08:25 UTC] tony2001@php.net
Make sure /tmp/ is not a symlink.

 [2007-01-24 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2010-02-25 01:51 UTC] sebastian at hometronix dot de
I had the same problem a few days ago, but now it works fine.

I just changed:

php_admin_value open_basedir "/home/somthing/:/tmp/"

-->

php_admin_value open_basedir /home/somthing/:/tmp

Try it!
 [2010-02-25 14:10 UTC] pajoye@php.net
Fixed already in all releases.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 10:03:03 2014 UTC