Created
March 28, 2017 16:53
-
-
Save soachishti/41c5ca35003c0d62bff62afca81a5410 to your computer and use it in GitHub Desktop.
Reset permission of all files and directory to 0755 - WordPress
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 | |
$rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('/public_html/')); | |
$files = array(); | |
foreach ($rii as $file) { | |
if (!$file->isDir()) { | |
chmod($file->getPathname(), 0755); | |
} | |
else { | |
chmod($file->getPathname(), 0755); | |
} | |
} | |
$wp = array( | |
'/public_html/', | |
); | |
foreach ($wp as $site) { | |
echo "Processing $site ...\n"; | |
chmod($site, 0755); | |
chmod($site . 'wp-includes', 0755); | |
chmod($site . 'wp-admin', 0755); | |
chmod($site . 'wp-admin/js', 0755); | |
chmod($site . 'wp-admin', 0755); | |
chmod($site . 'wp-content/themes', 0755); | |
chmod($site . 'wp-content/plugins', 0755); | |
chmod($site . 'wp-content', 0755); | |
chmod($site . 'wp-content/uploads', 0755); | |
chmod($site . 'wp-config.php', 0444); | |
chmod($site . '.htaccess', 0444); | |
} | |
echo "Done.\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment