php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #55491 Add temp directory setting which is used by tempnam(), sys_get_temp_dir(), etc.
Submitted: 2011-08-23 13:18 UTC Modified: 2015-12-07 19:45 UTC
Votes:8
Avg. Score:4.6 ± 0.5
Reproduced:8 of 8 (100.0%)
Same Version:2 (25.0%)
Same OS:0 (0.0%)
From: royanee at yahoo dot com Assigned:
Status: Duplicate Package: PHP options/info functions
PHP Version: 5.3.7 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: royanee at yahoo dot com
New email:
PHP Version: OS:

 

 [2011-08-23 13:18 UTC] royanee at yahoo dot com
Description:
------------
Need to be able to set the location of the temporary directory for a VirtualHost using php_admin_value.

This is especially important when you have multiple VirtualHosts that are locked down with open_basedir so that they are not able to read the files in the currently shared temporary directory.

tempnam() and sys_get_temp_dir() should pull the value from this PHP setting so that no code modifications are needed. For backward compatibility, the current default value of the temporary directory can be used to set the default value for the PHP setting.

Test script:
---------------
<?php
// Make sure to put this line in your vhost config!
// php_admin_value tmp_dir "/www/myvhost/tmp"
//
// Create a temporary file in the temporary 
// files directory using sys_get_temp_dir()
echo sys_get_temp_dir() . PHP_EOL;
echo tempnam(null, 'Tux') . PHP_EOL;
?>

Expected result:
----------------
/www/myvhost/tmp
/www/myvhost/tmp/TuxDRhRIg


Actual result:
--------------
/tmp
/tmp/TuxDRhRIg


Patches

tmp_dir.patch (last revision 2011-08-23 14:18 UTC by royanee at yahoo dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-26 05:19 UTC] royanee at yahoo dot com
FR #60524 is a duplicate of this request - yet has been incorporated into PHP 5.5.0 
Alpha 5. Thank you to those who pushed for this.

This request can be marked as fixed in 5.5 (or as a duplicate if you're a 
revisionist ;)).
 [2015-12-07 19:45 UTC] tyrael@php.net
-Status: Open +Status: Duplicate
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 02:01:30 2024 UTC