Bug #80492 [Opn->Nab]: CHMOD does not work

From: Date: Mon, 07 Dec 2020 17:33:49 +0000
Subject: Bug #80492 [Opn->Nab]: CHMOD does not work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-230918@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80492&edit=1 ID: 80492 Updated by: peehaa@php.net Reported by: gilperon at gmail dot com Summary: CHMOD does not work -Status: Open +Status: Not a bug Type: Bug Package: *General Issues Operating System: CENTOS 7 and 8 PHP Version: 8.0.0 Block user comment: N Private report: N New Comment: This is just how it works. To chmod a file you either need to be the owner or root Previous Comments: ------------------------------------------------------------------------ [2020-12-07 17:30:43] gilperon at gmail dot com Description: ------------ This bug happens also on PHP 7.X and 8.X. When using PHP command "chmod(filename,persmission);" on a file owned by "root", PHP will say "Operation not permitted". Alright, it looks fine, since apache runs as "apache" user. HOWEVER I can easily use "unlink", "move_uploaded_file", "file_put_contents" and many other PHP functions on files OWNED BY ROOT and any other user. So why cant "chmod" change the file permission of a file that other PHP functions may well EVEN DELETE OR WRITE to that file, despite being owned by another user on ther server. I can see how this isnt a bug and it took me 3 hours to get to the bottom of it cause I couldnt belive what was happening since I could easily read/write to files but weirdly, "chmod" couldnt change permission. Test script: --------------- chdmod(filename,0777) Expected result: ---------------- permission should be shown Actual result: -------------- OPERATION NOT PERMITTED. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80492&edit=1

« previous php.bugs (#230918) next »