How does FTP compare to using chmod or mkdir in setting directory permissions in PHP?

FTP allows for remote file management and permissions setting, while chmod and mkdir are PHP functions used for setting directory permissions locally. To set directory permissions in PHP, you can use the chmod function to change the permissions of a directory, and the mkdir function to create a new directory with specific permissions.

// Set directory permissions using PHP
$directory = 'path/to/directory';
$permissions = 0755; // Example permissions

if (!file_exists($directory)) {
    mkdir($directory, $permissions, true);
} else {
    chmod($directory, $permissions);
}