php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31602 tmpfile() fails
Submitted: 2005-01-19 01:42 UTC Modified: 2005-01-21 11:54 UTC
From: stasonis at mcs dot suffolk dot edu Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 5.0.3 OS: Mandrake 10.1
Private report: No CVE-ID: None
 [2005-01-19 01:42 UTC] stasonis at mcs dot suffolk dot edu
Description:
------------
I tried using imagegif to display an image and it gave the error:

Warning: imagegif() [function.imagegif]: Unable to open temporary file in /home/stasonis/public_html/image.php on line 14

After testing the tmpfile function I realized this did not work either.  Both the directory the script resides in and /tmp have rwx permissions for everyone, so I don't think it is a permissions issue

Reproduce code:
---------------
$temp = tmpfile();
if(!$temp){
	echo "Failure";
	return;
}
echo "Success";

Expected result:
----------------
Success to be echoed

Actual result:
--------------
Failure Echoed

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-19 01:48 UTC] stasonis at mcs dot suffolk dot edu
Also, if I specify the file in imagegif(), ie:
imagegof($im, "test.gif");
This works fine, even if I change the path of the file to "/tmp/test.gif"

ps - I entered the wrong email on the last submission
 [2005-01-20 23:51 UTC] tony2001@php.net
Please, execute `echo $TMP` in console as root and tell us what you got.
 [2005-01-21 09:10 UTC] derick@php.net
AFAIK does Mandrake clean the environment when starting apache, removing the TMP environment setting. This means that  /root/tmp wil be chosen causing problems, as the webserver can't usually write to that.
 [2005-01-21 11:54 UTC] derick@php.net
It's a "bug" in the Mandrake package. I consulted with them and their reply was:

  OK. I have fixed that. TMP and TMPDIR points to /tmp now.
  Previousely these where zeroed out. Many runtime things
  can be set using the /etc/sysconfig/httpd file now.

So please upgrade the their latest package (dated after today).

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 18:01:34 2024 UTC