Не удается поменять разрешения на файл с помощью chmod php
<?php
echo "Current user:".get_current_user()."\r\n";
$processUser = posix_getpwuid(posix_geteuid());
print "Process user:".$processUser['name']."\r\n";
chdir( dirname ( __FILE__ ) );
//$old = umask(0);
$fname='./1.js';
//$fname= dirname ( __FILE__ ).'/1.js';
echo $fname."\r\n";
echo "current perm:".substr(sprintf('%o', fileperms($fname)), -4)."\r\n";
$permitions=fileperms($fname);
chmod($fname,0444);
echo "Try to 444:\r\n";
echo "current perm:".substr(sprintf('%o', fileperms($fname)), -4)."\r\n";
echo "Return:\r\n";
chmod($fname,$permitions);
echo "current perm:".substr(sprintf('%o', fileperms($fname)), -4)."\r\n";
//umask($old);
?>
Выход:
Current user:apache
Process user:apache
./1.js
current perm:0644
Try to 444:
current perm:0644
Return:
current perm:0644