Edit report at https://bugs.php.net/bug.php?id=55491&edit=1
ID: 55491 Comment by: royanee at yahoo dot com Reported by: royanee at yahoo dot com Summary: Add temp directory setting which is used by tempnam(), sys_get_temp_dir(), etc. Status: Open Type: Feature/Change Request Package: PHP options/info functions PHP Version: 5.3.7 Block user comment: N Private report: N New Comment: 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 ;)). Previous Comments: ------------------------------------------------------------------------ [2011-08-23 13:18:08] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=55491&edit=1