Created
April 21, 2014 00:12
-
-
Save vibbow/11128729 to your computer and use it in GitHub Desktop.
Ubuntu /var/www 目录权限修复脚本
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$path = '/var/www'; | |
`chown -R www-data:www-data {$path}`; | |
`chown root:root {$path}`; | |
mod_dir($path); | |
function mod_dir($path) { | |
$files = scandir($path); | |
foreach ($files as $file) { | |
if ($file == '.' || $file == '..') | |
continue; | |
$file_path = "{$path}/{$file}"; | |
if (is_dir($file_path)) { | |
chmod($file_path, 0755); | |
mod_dir($file_path); | |
} else { | |
chmod($file_path, 0644); | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment