linux檔案許可權 777.755.644 550,這樣頭痛的關鍵詞,對於初學magento的童鞋很鬱悶,因為很多情況下是由於這些問題造成這個或那個的問題,如:安裝外掛程式,大量匯入,後台配置,等等讓人頭痛。現在提供兩種方式處理該許可權問題
SSH方式(適用於獨立伺服器或VPS)
代碼如下 |
複製代碼 |
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 If that is not working, try setting all directories to 777 by doing this: find . -type f -exec chmod 644 {} ; find . -type d -exec chmod 777 {} ; chmod o+w var/.htaccess chmod 550 mage |
magento中操作
比如二級菜單不可用,Magento Connect 不可用,圖片不顯示等等,大部分原因都是檔案許可權沒設定或者設定不當引起的。下面是基本的檔案及檔案夾設定。
755許可權
代碼如下 |
複製代碼 |
magento/app/etc magento/media magento/app magento/skin magento/var magento/var/.htaccess magento/js magento/downloader 644許可權 magento/index.php magento/downloader/index.php |
php修改許可權
代碼如下 |
複製代碼 |
<?php ## 設定檔案644,目錄755 function AllDirChmod( $dir = "./", $dirModes = 0755, $fileModes = 0644 ){ $d = new RecursiveDirectoryIterator( $dir ); foreach( new RecursiveIteratorIterator( $d, 1 ) as $path ){ if( $path->isDir() ) chmod( $path, $dirModes ); else if( is_file( $path ) ) chmod( $path, $fileModes ); } } ?> |
?>