Req #44972 [Com]: Feature Request: overriding sys_get_tmp_dir
Edit report at https://bugs.php.net/bug.php?id=44972&edit=1
ID: 44972
Comment by: jan dot kellermann at werk21 dot de
Reported by: timtowdi at yahoo dot com
Summary: Feature Request: overriding sys_get_tmp_dir
Status: Open
Type: Feature/Change Request
Package: Feature/Change Request
Operating System: FreeBSD
PHP Version: 5.2.6
Block user comment: N
Private report: N
New Comment:
Please just add a flag to this function for loading the default tmp-dir (cached in
static var) or get it actually from env TMPDIR.
There ARE situations you dont want to save your user-temp-files to your sys-temp-
dir. Then you can use SetEnv in apache-conf.
Previous Comments:
------------------------------------------------------------------------
[2011-03-14 19:35:45] royanee at yahoo dot com
sys_get_tmp_dir() and tempnam() are both affected on my system. However, using SetEnv TMPDIR in the
Apache configuration does not work. getenv('TMPDIR') returns the expected result, but
sys_get_tmp_dir() is unaffected. Please allow for a default temporary directory option so that I can
switch my virtual hosts to that and resolve all of the temporary file issues (not simply uploads).
------------------------------------------------------------------------
[2010-09-07 05:44:47] brian at macserve dot net
1. the suggested php.ini setting for "uploaded files" has ZERO effect on the original
requestors report. the directory returned by the sys_get_tmp_dir() function cannot be overriden from
within PHP or php.ini; only where uploaded files are placed can be overridden which only
coincidentally is the same when you do NOT define upload_tmp_dir in php.ini.
the original request stands as a valid critique.
2. your url is missing an "el" at the end of manual.
corrected:
http://www.php.net/manual/en/ini.core.php#ini.upload-tmp-dir
3. The security environment of the original request is interesting and perhaps up for debate, but is
not relevant to this discussion.
There may be valid technical reasons for locating TMPDIR for PHP to another location other than the
TMPDIR environment variable that comes into Apache. Perhaps temp files for PHP need to live on a
different disk for performance and/or security reasons.
Being able to define this with a php.ini setting is completely reasonable.
4. Sorry to be a noodge, but this request over 2 years old and not resolved?
./main/php_open_temporary_file.c : php_get_temporary_directory() needs just a little bit of code it
looks like.
Thanks!
------------------------------------------------------------------------
[2008-05-12 15:46:49] pajoye@php.net
One is already possible:
http://www.php.net/manua/en/ini.core.php#ini.upload-tmp-dir
About the temp directory, you will have to teach your ISP how to configure php correctly. Not having
the tmp dir in the open_basedir lists (and having only one global tmp dir instead of per user) is so
wrong.
However a temp_dir ini setting (settable per vhost) would be nice. Let see what's the other say
(I'm not a fan of ENV variables ;).
------------------------------------------------------------------------
[2008-05-12 15:30:47] timtowdi at yahoo dot com
Description:
------------
On a server with open_basedir in effect, sys_get_temp_dir() still uses the default TMPDIR
environment variable (which in this case is '/tmp'). This effectively renders
sys_get_temp_dir useless for me, and there is no way to override it.
It would be EXTREMELY useful to be able to set the default temp directory from an ini directive,
such as the session temp dir and the uploaded files temp dir.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=44972&edit=1
Thread (6 messages)