php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44420 upload_tmp_dir directive in php.ini ignored for file uploads
Submitted: 2008-03-12 16:36 UTC Modified: 2009-08-29 01:00 UTC
Votes:15
Avg. Score:4.4 ± 1.1
Reproduced:15 of 15 (100.0%)
Same Version:5 (33.3%)
Same OS:5 (33.3%)
From: jturner at paycomonline dot com Assigned:
Status: No Feedback Package: IIS related
PHP Version: 5.2.5 OS: Windows Server 2003
Private report: No CVE-ID: None
 [2008-03-12 16:36 UTC] jturner at paycomonline dot com
Description:
------------
The upload_tmp_dir directive is set in the php.ini to "C:\DOCUME~1\ADMINI~1.HQ-\LOCALS~1\Temp\php\upload" and shows up as such when running phpinfo().  However, when I try to upload a file it fails,  and print_r($_FILES) reports that "tmp_name" is set to "C:\WINDOWS\TEMP\[filename]".  It appears that the directive is being ignored in favor of the environment variable, which is contrary to the documentation.  

PHP5.2.5/IIS6.0/Windows Server 2003

A search of the bug database turned up bug #39451 which appears to be similar but was marked as fixed in 5.2.1RC3.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-13 12:19 UTC] jani@php.net
Is that path writable/readable by the user with which the webserver runs as?
 [2008-03-13 13:17 UTC] jturner at paycomonline dot com
Yes, the IWAM and IUSR accounts both have read, write, and list folder contents rights in the ACL for that directory. I forgot to mention yesterday that I have PHP set to run as an ISAPI module.
 [2008-11-13 15:39 UTC] alb dot amati at tiscali dot it
It seems I have the same problem.
Exactly the same configuration.
Any workaround?

Thanx
Alb
 [2008-11-18 00:38 UTC] kalle@php.net
I'm not totally sure, but I think its somehow related to the path like: X:\dir~1\..., can you try without using the ~N syntax?
 [2009-03-01 01:22 UTC] kalle@php.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.


 [2009-08-21 18:42 UTC] adam at ingenesis-ca dot com
Experiencing exactly the same thing... I ran phpinfo() and it properly 
reflects the new php.ini setting in local and master, but the script 
keeps throwing an error saying "/var/tmp/phpiXsjk3" doesn't exist (the 
original path that i don't want to use).  What the F.
 [2009-08-21 19:36 UTC] pajoye@php.net
"/var/tmp/phpiXsjk3"? That's a linux path. Which php version do you use and on which platform?
 [2009-08-29 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-04-20 04:55 UTC] f dot moretti at diciannove dot net
I'm using php from debian package, PHP 5.2.13-0.dotdeb.0, that come with suhosin-patch 0.9.7, and i've written in my vhost configuration file this directive:

php_admin_value   open_basedir      /home/data/mysite.org/:/usr/lib/php

php_admin_value   upload_tmp_dir    /home/data/mysite.org/tmp/

but when i try to upload a file i receive this error:

PHP Warning:  file(): open_basedir restriction in effect. File(/tmp/phpCtsVNF) is not within the allowed path(s): (/home/data/mysite.org/:/usr/lib/php) in /home/data/mysite.org/file3.php on line 85

PHP Warning:  file(/tmp/phpCtsVNF): failed to open stream: Operation not permitted in /home/data/mysite.org/file3.php on line 85

php is ignoring my directive, any workaround?
 [2012-01-11 07:39 UTC] bushkonst at gmail dot com
I had a same problem: Win2008R2, PHP 5.2.12, and (upload_tmp_dir != tmp_name) when uploading.
I had list the "upload_tmp_dir" on c:\ and in it was 65535(!) files php1.tmp - phpFFFF.tmp. After truncatig folder, PHP become upload files corectly to "upload_tmp_dir"
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC