php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #60524 specify temp dir by php.ini
Submitted: 2011-12-14 14:33 UTC Modified: 2013-01-29 06:58 UTC
Votes:11
Avg. Score:4.3 ± 0.7
Reproduced:11 of 11 (100.0%)
Same Version:2 (18.2%)
Same OS:3 (27.3%)
From: mail+bugs dot php dot net at kazik dot de Assigned: stas (profile)
Status: Closed Package: Filesystem function related
PHP Version: * OS: *
Private report: No CVE-ID: None
 [2011-12-14 14:33 UTC] mail+bugs dot php dot net at kazik dot de
Description:
------------
This patch (against 5.3.8) adds a new php.ini directive to specify the path for the temporary files.

Why:
If, for security reasons, every user is only allowed to use their own home directories, it's not possible to specify their own tmp dir (e.g. "/home/user/tmp"). The directory for uploading and session can already be specified. Since all users may use the same php.ini (different [HOST=domain] entries, [1]) it's not possible to set the environment TMPDIR variable, because it would affect all users.

[1] http://php.net/manual/en/ini.sections.php

Test script:
---------------
ini: system_tmp_dir = "/home/user/tmp"

php: var_export(sys_get_temp_dir());

Expected result:
----------------
'/home/user/tmp'

Actual result:
--------------
'/tmp' (depends on system configuration)

Patches

patch_php-5.4.3_custom-tmp-dir (last revision 2012-05-10 15:25 UTC by mail+bugs dot php dot net at kazik dot de)
patch_php-5.4.0_custom-tmp-dir (last revision 2012-03-13 15:59 UTC by mail+bugs dot php dot net at kazik dot de)
patch_php-5.3.8_custom-tmp-dir (last revision 2011-12-14 14:34 UTC by mail+bugs dot php dot net at kazik dot de)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-05-10 15:25 UTC] mail+bugs dot php dot net at kazik dot de
-Operating System: All +Operating System: * -PHP Version: Irrelevant +PHP Version: *
 [2012-05-10 15:25 UTC] mail+bugs dot php dot net at kazik dot de
Added patch for 4.3.4
 [2012-05-10 15:27 UTC] mail+bugs dot php dot net at kazik dot de
Added patch for 5.3.4, of course (and not 4.3.4)
 [2013-01-29 06:58 UTC] stas@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: stas
 [2013-01-29 06:58 UTC] stas@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

merged into 5.5 as 475a644bd84c071da04b4272b829a187a2c6d282
 [2013-07-09 12:07 UTC] mail at tomsommer dot dk
Any chance of getting this backported to 5.3 and 5.4?
 [2013-07-11 13:54 UTC] mail+bugs dot php dot net at kazik dot de
The 5.5's pull request is here:
https://github.com/php/php-src/pull/262

It should be easy to patch 5.4 and 5.3 with that or a slightly modified version 
(there a older patches for 5.3 and 5.4 available).

Whether this should be backported or not is not for me to decide.

So, feel free to port.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 05:01:29 2024 UTC