簡體   English   中英

應用模塊時出錯:magento 2.1.7 中的啟用命令

[英]Error on applying module:enable command in magento 2.1.7

我遇到了錯誤,不知道為什么它是由應用如下簡單命令引起的:

bin> php magento module:enable CustomModuleExt

版本:

Magento 2.1.7

錯誤:

The file "/home/mywebsite/public_html/generated/code/Magento/Framework/Indexer/IndexerInterfaceFactory.php" cannot be deleted Warning!unlink(/home/mywebsite/public_html/generated/code/Magento/Framework/Indexer/IndexerInterfaceFactory.php): Permission denied

是什么導致了這個問題,我該如何解決?

我無法推斷出您將要進行哪種環境設置的許多線索,但我認為您處於開發人員模式,並且從目錄的位置我假設您在共享主機上以及一個 -用戶設置:在這種情況下,您應該保持某些目錄可寫,並且 Magento 的文檔為您提供了非常全面的指導

cd <magento_root>
find var generated vendor pub/static pub/media app/etc -type f -exec chmod u+w {} +
find var generated vendor pub/static pub/media app/etc -type d -exec chmod u+w {} +

特別是,重要的部分是這個:

要使用單一所有者設置,您必須以運行 web 服務器的同一用戶身份登錄到 Magento 服務器。 這對於共享主機來說是典型的。

在多用戶環境中: 為兩個用戶設置所有權和權限

在這種情況下,問題通常在於這些目錄的所有權,如果它不屬於您的網絡服務器組,即:youruser:www-data(例如 apache2)。 在這種情況下,您的問題將通過以下步驟 5 解決:

Log in to your Magento server as, or switch to, the Magento file system owner.
Enter the following commands in the order shown:

cd <magento_root>
find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
chown -R :<web server group> .
chmod u+x bin/magento

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM