Is it possible to change the permissions of the root directory using PHP, or is this typically managed server-side?

It is typically managed server-side to change the permissions of the root directory for security reasons. However, it is possible to change permissions of specific files or directories within the root directory using PHP, but changing permissions of the root directory itself may not be recommended.

// Example of changing permissions of a specific directory using PHP
$directory = '/path/to/directory';
$permissions = 0755; // set the desired permissions

if (is_dir($directory)) {
    chmod($directory, $permissions);
    echo "Permissions changed for directory: $directory";
} else {
    echo "Directory does not exist.";
}