We can change the folder permission for your server using ftp_chmod command here you go with the php script hope this helps when chmod() is not working.
$ftp_server='www.example.com';$ftp_user_name='FTPUSRname';
$ftp_user_pass='password';
$conn_id = ftp_connect($ftp_server)or die("asdfdf");
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
$file = '/public_html/subdomains/giorgio/';
if (ftp_chmod($conn_id, 0777, $file) !== false) {
echo "$file chmoded successfully to 777
";
}
else {
echo "could not chmod $file
";
}