歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux管理 >> Linux問題解決 >> Magento中文件與文件夾權限設置方法

Magento中文件與文件夾權限設置方法

日期:2017/3/6 10:16:40   编辑:Linux問題解決

如:安裝插件,批量導入,後台配置,等等讓人頭痛。現在提供兩種方式處理該權限問題

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 );
}
}
?>

Copyright © Linux教程網 All Rights Reserved