Reputation: 37
When i try to change a file's permissions it ends up either 0666 or 0444. Can't change it to 0777 or 0755.
for example:
chmod('test.php', 0777) // or 0755
echo substr(decoct(fileperms('test.php')), 2);
it changes permissions to 0666.
chmod('test.php', 0000)
echo substr(decoct(fileperms('test.php')), 2);
it changes permissions to 0444.
Upvotes: 2
Views: 819
Reputation: 2530
The directory must be owned by the user invoking the script (typically www-data, apache or httpd if you're running the script in a apache/*NIX setup). A user can't set 777 permissions on directories it doesn't own.
See the note on the chmod()
The current user is the user under which PHP runs. It is probably not the same user you use for normal shell or FTP access. The mode can be changed only by user who owns the file on most systems.
Upvotes: 2