Edit report at http://bugs.php.net/bug.php?id=51611&edit=1

 ID:               51611
 Updated by:       fel...@php.net
 Reported by:      f dot moretti at diciannove dot net
 Summary:          move_uploaded_file fails with open_basedir
-Status:           Open
+Status:           Feedback
 Type:             Bug
 Package:          Safe Mode/open_basedir
 Operating System: linux 2.6.18
 PHP Version:      5.2.13

 New Comment:

Please try using this snapshot:

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

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




Previous Comments:
------------------------------------------------------------------------
[2010-04-20 06:24:26] 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);

[...]





------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51611&edit=1

Reply via email to