I'm having real head busting issues with chmod command running in a PHP script.
I've just installed a fresh VPS, no Plesk, just an LAMP install using CentOS 6 64bit. I'm using SFTP instead of an FTP server, and create a user for the SFTP and added it to the apache group.
Site uploaded and works fine, but when I use a PHP script with a chmod command in it like so:
Code: Select all
define('ABS_PATH', rtrim( dirname(__FILE__), '/' ) . '/');
chmod(ABS_PATH . 'media/cache/', 0777);
Code: Select all
Warning: chmod(): Operation not permitted in /var/www/html/test.php on line 2
Now my frustration is, on a Plesk server I run this works without a problem. So I'm scratching what's left of the hair trying to work out why it runs fine on a Plesk server, yet not on my LAMP server even though the apache user and my SFTP user are both in the same group.
Can anyone shed some light on this?