On Mon, August 27, 2007 12:55 pm, Hugues De Keyzer wrote: > I'm having a weird problem on my web hosting provider's server. I'm > using drupal with the image module and the image_pub module to upload > a > series of pictures using Gallery Remote. This software uploads > pictures > one after the other using a classic HTTP POST method. > > The upload always succeeds, but the problem I have is that > move_uploaded_file() randomly fails. > open_basedir is set to /home/ > DOCUMENT_ROOT is /home/myuser > upload_tmp_dir is set to ./tmp-php/, which exists is /home/myuser and > has full 777 permission Set upload_tmp_dir to /home/myuser/tmp-php/ > First, 2 times: > move_uploaded_file() [function.move-uploaded-file]: open_basedir > restriction in effect. File(/var/tmp/phpNN2JDd) is not within the > allowed path(s): (/home/) because clearly PHP has decided to use the default system tmp dir for some reason, and relying on relative paths is always inherently suspect. Not that it seems to matter here, but there it is. :-v > then: > move_uploaded_file(/var/tmp/phpNN2JDd) [function.move-uploaded-file]: > failed to open stream: Operation not permitted > > move_uploaded_file() [function.move-uploaded-file]: Unable to move > '/var/tmp/phpNN2JDd' to 'files/tmp/res-2108703551.jpg' > > When it succeeds, the file is correctly uploaded in ./tmp-php. When it > fails, it goes to /var/tmp although upload_tmp_dir is still set to > "./tmp-php/". is_uploaded_file() returns true even when > move_uploaded_file() fails. > > What seems really strange to me is that it fails *randomly*. It works > for a couple of picture, then fails, then succeeds again, etc. You could try to log all your php.ini settings in your debug file, so see if there is anything tell-tale other than upload_tmp_dir to figure out WHY it randomly uses the default system tmp dir. Perhaps there is a rogue apache child left laying around that has some old php.ini setting, or was unable to read php.ini at startup and has fallen back to the default default values. > My web hosting provider doesn't really seem to care about such > problems, > so if I can point out this is a PHP bug and ask them for an update, it > would be great. It really sounds more like you are getting hit by something more random, say by some OTHER application screwing with upload_tmp_dir and then you inherit their setting... You'd think PHP would restore that one to php.ini setting, but... Alas, you can't just set this at the top of your script or anything, as the effect of the setting has already happened long before your PHP code starts running. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php