When you would try to change the filepermission with a php script on your hosting, you would probably run into an "Operation not permitted" error.
This is because save mode is enabled. To bypass this limitation you could login unter ftp and change the file permission from there.
PHP:
-
//settings
-
$folders =
array("/feeds/",
"/sitemap/");
-
$ftp_details['ftp_user_name'] = "username";
-
$ftp_details['ftp_user_pass'] = "pw";
-
$ftp_details['ftp_root'] = '/defaultfolder/';
-
$ftp_details['ftp_server'] = 'ftp.domain.com';
-
-
//function to login and change by FTP
-
function chmod_custom($path, $mod, $ftp_details)
-
{
-
// extract ftp details (array keys as variable names)
-
-
-
// set up basic connection
-
-
-
// login with username and password
-
$login_result =
ftp_login($conn_id,
$ftp_user_name,
$ftp_user_pass);
-
-
// try to chmod $path directory
-
if (ftp_site($conn_id,
'CHMOD '.
$mod.
' '.
$ftp_root.
$path) !==
false) {
-
$success=TRUE;
-
}
-
else {
-
$success=FALSE;
-
}
-
-
// close the connection
-
-
return $success;
-
}
-
-
//the actual transaction
-
foreach($folders as $folder){
-
chmod_custom($folder, "0777", $ftp_details);
-
-
}
I found this solution on php.net.
RSS feed for comments on this post · TrackBack URI
Leave a reply