note 96221 added to function.touch

From: Date: Mon, 15 Feb 2010 23:02:02 +0000
Subject: note 96221 added to function.touch
Groups: php.notes 
Request: Send a blank email to php-notes+get-165988@lists.php.net to get a copy of this message
Regarding the permission error, also discussed in other notes: Warning: touch() [function.touch]: Utime failed: Operation not permitted in /directory/file.php on line X On my system PHP can touch files it does not own as long as the file has at least chmod xx6, BUT it can not set modification time. This works: touch('notmyfile'); # -rw-rw-rw- 1 root root 0 2010-02-15 23:39 notmyfile This gives error above: touch('notmyfile', time()); # -rw-rw-rw- 1 root root 0 2010-02-15 23:39 notmyfile This works: touch('notmyfile', time()); # -rw-rw-rw- 1 apache root 0 2010-02-15 23:41 notmyfile Note that user is APACHE and not NOBODY. On some systems with apache web server, PHP runs as apache. To check what user your PHP run as, you may try this to find out: echo shell_exec('whoami'); ---- Server IP: 194.236.124.41 Probable Submitter: 81.229.42.59 ---- Manual Page -- http://www.php.net/manual/en/function.touch.php Edit -- https://master.php.net/note/edit/96221 Del: integrated -- https://master.php.net/note/delete/96221/integrated Del: useless -- https://master.php.net/note/delete/96221/useless Del: bad code -- https://master.php.net/note/delete/96221/bad+code Del: spam -- https://master.php.net/note/delete/96221/spam Del: non-english -- https://master.php.net/note/delete/96221/non-english Del: in docs -- https://master.php.net/note/delete/96221/in+docs Del: other reasons-- https://master.php.net/note/delete/96221 Reject -- https://master.php.net/note/reject/96221 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#165988) next »