php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51611 move_uploaded_file fails with open_basedir
Submitted: 2010-04-20 06:24 UTC Modified: 2013-02-18 00:34 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: f dot moretti at diciannove dot net Assigned:
Status: No Feedback Package: Safe Mode/open_basedir
PHP Version: 5.2.13 OS: linux 2.6.18
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: f dot moretti at diciannove dot net
New email:
PHP Version: OS:

 

 [2010-04-20 06:24 UTC] f dot moretti at diciannove dot net
Description:
------------
I have this vhost settings:

<Location />
  php_admin_value   open_basedir      /home/data/site.org/tmp/:/home/web/site.org/
  php_admin_value   doc_root          /home/web/site.org/
  php_admin_value   upload_tmp_dir    /home/data/site.org/tmp/
</Location>

doing a move_uploaded_file to the upload_tmp_dir result in a failure:

PHP Warning:  move_uploaded_file(): open_basedir restriction in effect. File(/home/data/site.org/tmp/FLOSG5_new.000) is not within the allowed path(s): (/home/data/site.org/tmp/:/home/web/site.org/) in /home/web/site.org/fileupload.php on line 11

In the same error string is visible that the upload_tmp_dir path is in the open_basedir directive.

I'm on a debian VM with linux 2.6.18 kernel, the /home dir is mounted via NFS and apache is chrooted with mod_chroot. 

Test script:
---------------
Any simple upload script with these lines of code:

[...]
    $from = $_FILES['uploadedfile']['tmp_name'];
    $flog = ini_get('upload_tmp_dir').$_FILES['uploadedfile']['name'];
    move_uploaded_file($from,$flog);
[...]



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-27 21:03 UTC] felipe@php.net
-Status: Open +Status: Feedback
 [2010-04-27 21:03 UTC] felipe@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 15:01:29 2024 UTC