Magento中檔案與檔案夾使用權限設定

來源:互聯網
上載者:User

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

?>

?>

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.