note 93256 added to function.tempnam

From: Date: Mon, 31 Aug 2009 00:39:53 +0000
Subject: note 93256 added to function.tempnam
Groups: php.notes 
Request: Send a blank email to php-notes+get-160068@lists.php.net to get a copy of this message
Watch out using a blank $dir as a "trick" to create temporary files in the system temporary directory. <?php $tmpfname = tempnam('', 'FOO'); // not good ?> If an open_basedir restriction is in effect, the trick will not work. You will get a warning message like Warning: tempnam() [function.tempnam]: open_basedir restriction in effect. File() is not within the allowed path(s): (/var/www/vhosts/domain.com/httpdocs:/tmp) What works is this: <?php $tmpfname = tempnam(sys_get_temp_dir(), 'FOO'); // good ?> ---- Server IP: 195.184.96.15 Probable Submitter: 217.157.204.183 ---- Manual Page -- http://www.php.net/manual/en/function.tempnam.php Edit -- https://master.php.net/note/edit/93256 Del: integrated -- https://master.php.net/note/delete/93256/integrated Del: useless -- https://master.php.net/note/delete/93256/useless Del: bad code -- https://master.php.net/note/delete/93256/bad+code Del: spam -- https://master.php.net/note/delete/93256/spam Del: non-english -- https://master.php.net/note/delete/93256/non-english Del: in docs -- https://master.php.net/note/delete/93256/in+docs Del: other reasons-- https://master.php.net/note/delete/93256 Reject -- https://master.php.net/note/reject/93256 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#160068) next »