90% 以上皆為檔案權限設定不當所致。
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod o+w var var/.htaccess app/etc
chmod 550 mage
chmod -R o+w media
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 777 {} \;
chmod o+w var/.htaccess
chmod 550 mage
magento/app/etc
magento/media
magento/app
magento/skin
magento/var
magento/var/.htaccess
magento/js
magento/downloader
magento/index.php
magento/downloader/index.php
<?php
function AllDirChmod($dir = "./", $dirMode = 0755, $fileMode = 0644) {
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($dir),
RecursiveIteratorIterator::SELF_FIRST
);
foreach ($iterator as $path) {
if ($path->isDir()) {
chmod($path, $dirMode);
} elseif ($path->isFile()) {
chmod($path, $fileMode);
}
}
}
AllDirChmod();
?>
將上述碼存為 fix_perms.php 放入 Magento 根目錄,瀏覽器執行即可。
app/etc/local.xmlrm -rf var/cache/* var/session/*