How can PHP scripts be used to adjust directory and file permissions in a Windows environment where FTP access is limited?

In a Windows environment where FTP access is limited, PHP scripts can be used to adjust directory and file permissions by utilizing the `icacls` command through the `exec()` function in PHP. This allows you to set specific permissions for directories and files programmatically without relying on FTP access.

<?php
// Set the directory path and desired permissions
$directory = 'C:/path/to/directory';
$permissions = 'F:\Users:(OI)(CI)F';

// Execute icacls command to set permissions
exec("icacls $directory /grant $permissions", $output, $return);

// Check if permissions were successfully set
if ($return === 0) {
    echo "Permissions set successfully.";
} else {
    echo "Error setting permissions.";
}
?>