ID: 33241 Updated by: [EMAIL PROTECTED] Reported By: kylewong at southa dot com -Status: Open +Status: Bogus Bug Type: *Directory/Filesystem functions Operating System: linux kernel 2.6.10 PHP Version: 4.3.11 New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. Previous Comments: ------------------------------------------------------------------------ [2005-06-04 12:08:22] kylewong at southa dot com all errors happen here ---> $ret = copy($out, $dest); should be: all errors happen here ---> $ret = fs_copy($out, $dest); and /home/platform/fs_unix.php line 15 is just: $result = copy($source, $dest); ------------------------------------------------------------------------ [2005-06-04 11:52:55] kylewong at southa dot com Description: ------------ I have a script which unzip an uploaded ZIP file (contains image files) into a temp directory, "/dev/shm/tmp" (tmpfs for speed, I tried to use /tmp but still got the problem), which is owned by "nobody" and 777 in permission. The script will then process the unzipped image files, one by one, by calling an resize_image() function. The resize_image() function will try to resize the image, then copy the resized image to somewhere else. The script works most of the time, but sometime, it failed with something like: [04-Jun-2005 17:19:47] PHP Warning: copy(/dev/shm/tmp/00800040.jpg): failed to open stream: Permission denied in /home/platform/fs_unix.php on line 15 [04-Jun-2005 17:19:48] PHP Warning: copy(/dev/shm/tmp/00800041.jpg): failed to open stream: Permission denied in /home/platform/fs_unix.php on line 15 [04-Jun-2005 17:19:49] PHP Warning: copy(/dev/shm/tmp/00800042.jpg): failed to open stream: Permission denied in /home/platform/fs_unix.php on line 15 [04-Jun-2005 17:19:50] PHP Warning: copy(/dev/shm/tmp/00800043.jpg): failed to open stream: Permission denied in /home/platform/fs_unix.php on line 15 ..... when the error happens, all of the files insize the same zip file will result in same error. I don't really know what's wrong since the scipt sometime works, sometime doesn't Reproduce code: --------------- util.php, $src will == $dest, $target is target size function resize_image($src, $dest, $target) { if (!strcmp($src,$dest)) { $useTemp = true; $out = "$dest.tmp"; } else { $out = $dest; $useTemp = false; } /* resize xxx.jpg to xxx.jpg.tmp at the same directory */ $err = exec_wrapper("convert -quality 85 -size ${target}x${target} $src $out"); if (file_exists("$out") && filesize("$out") > 0) { if ($useTemp) { //// copy back xxx.jpg.tmp to xxx.jpg //// all errors happen here ---> $ret = copy($out, $dest); unlink($out); if (!$ret){ return 0; } return 1; } } else { return 0; } } Expected result: ---------------- fs_copy() should not be failed with "permission denied" error Actual result: -------------- something failed with permission error ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33241&edit=1