安装Magento 2.x
出现以下问题是因为权限设置不当,需要重置下文件和文件夹权限。
( ! ) Fatal error: Uncaught ReflectionException: Class Magento\Framework\App\ResourceConnection\Proxy does not exist in /lib/internal/Magento/Framework/Code/Reader/ClassReader.php on line 26
( ! ) ReflectionException: Class Magento\Framework\App\ResourceConnection\Proxy does not exist in /lib/internal/Magento/Framework/Code/Reader/ClassReader.php on line 26
SSH
进入网站根目录,输入:
sudo chown -R :www . sudo find . -type d -exec chmod 770 {} + && find . -type f -exec chmod 660 {} + && chmod u+x bin/magento sudo find . -type d -exec chmod 770 {} + && sudo find . -type f -exec chmod 660 {} + && sudo chmod u+x bin/magento
这些命令为Magento 2.x
的安装配置了文件所有权和权限:
sudo chown -R :www .
将当前目录(.
)中所有文件和目录的组所有权递归(-R
)更改为www
组(通常用于Apache
或Nginx
等Web
服务器)。sudo find . -type d -exec chmod 770 {} +
将当前目录中所有目录(-type d
)的权限设置为770
(所有者和组可读、写、执行,其他人无权限)。sudo find . -type f -exec chmod 660 {} +
将当前目录中所有文件(-type f
)的权限设置为660
(所有者和组可读、写,其他人无权限)。sudo chmod u+x bin/magento
为bin/magento
文件的所有者添加执行权限。