On 25-Mar-2003 Christian Rosentreter wrote: > > Hello, > > I've a small problem, which mades me crazy... :\ > > I'm trying to rename() a swapfile to real destination file (atomic > update). > It works on differnt environments very well. Sadly not on my ISP-server > I've added an "chmod($swapfile,0777)", but this has not solve the > problem. > The directories have all FULL access (read, write, etc.). The > destiniation file > too. I don't want 2 use the copy/unlink solution.... Do anyone have an > idea? > > --- 8< --- > > if ( $file = fopen($swapfile,"w") ) > { > fwrite($file,$out); > fclose($file); > chmod($swapfile, 0777); > > /* this fails with "Permission denied" */ > rename($swapfile,$filename); > > /* ... but this works */ > copy($swapfile,$filename); > unlink($swapfile); > } > > --- 8< ---- >
On *nix, rename will fail if source and destination are different file systems. To test this : copy($swapfile,$filename); clearstatcache(); $src=stat($swapfile); $dst=stat($filename); printf('Source: %d, Dest: %d %s filesystem\n', $src[0], $dst, ($src[0] == $dst[0] ? 'same' : 'different')); > > Thanks 4 help... > -- > christian rosentreter > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php