I have files that owned by root and I want to change it permission with php using chmod(). But it gave me an error chmod(): Operation not permitted instead.
if (file_exists($filepath)) {
chmod($filepath, 0755);
}
How to use chmod() in php but the files ownership are root ?
Can I achieve this without changing files ownership ?
Application Environment:
- PHP 7.1.33
- Code Igniter 3 framework
- Apache 2.4.6
- CentOS Linux release 7.8.2003
Any answer are appreciated, thanks before.
EDIT:
I've run ps aux | grep httpd and it shows only root and apache on the list.

