cant change file permission

Soldato
Joined
6 Jan 2006
Posts
3,423
Location
Newcastle upon Tyne
need to change the permission of a file to 444 from 644 but when I do it and then refresh it defaults back to 644?

Any ideas?

Thanks, Mark
 
Just spoke to my host about this and they said try a php script to change the permission? What does that mean? They couldnt be of any more help!!
 
Change the value of $file as appropriate, save as a .php, upload and open it in a browser. I recommend deleting it after you've finished using it:
Code:
<?php
$file = "/path/to/your/filename";
if (chmod($file, 0444)) {
	echo "Permissions  of $file changed.";
} else {
	echo "Could not change permissions of $file.";
}
echo '<br />The file permissions are now set to: ';
echo substr(sprintf('%o', fileperms($file)), -4);
It will fail if the user PHP is running at doesn't have permissions to change the file e.g. it's not the file owner.
 
It's probably the path to the file that is incorrect. You need to specify either the full path of the filename (could be something like /home/yourusername/www/store/catalog/includes/configure.php) or put one relative to the PHP script (e.g. ./store/catalog/includes/configure.php if /store/ is a folder in your html directory).
 
Back
Top Bottom