前言
上一篇文章,我们使用命令安装了magento2.4.6,安装完毕后,可能还有其他一些奇奇怪怪的问题,这里做个整合
一、由于我们使用了nginx,所以在站点的配置文件里,需要接入magento自带的nginx配置
upstream fastcgi_backend {
server unix:/tmp/php-cgi-81.sock;
}
server {
listen 80;
server_name test.sbboke.com;
set $MAGE_ROOT /www/wwwroot/sbboke.com;
access_log /www/wwwlogs/sbboke.com.log;
error_log /www/wwwlogs/sbboke.com.error.log;
include /www/wwwroot/sbboke.com/nginx.conf.sample;
}
server {
server_name test.sbboke.com;
location / {
proxy_pass http://127.0.0.1;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Port 443;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
fastcgi_buffer_size 32k;
fastcgi_buffers 4 128k;
}
}
二、安装插件出现Fatal error: Uncaught Error: Class "Zend_Cache" not found in之类的报错,这是因为Zend框架 替换为 laminas 框架了,所以解决办法可以是把相关的变量替换成laminas 框架的变量,这是最符合magento发展的。
比如替换Zend_Json
为\Laminas\Json\Json
确保您已经安装laminas/laminas-serializer
还有一个解决方案是重新安装zend扩展,运行composer命令:
composer require magento/zendframework1