标签 magento2 下的文章

从 magento 1.x 升级到 magento 2.x - Data Migration Tool

需求:从现有的 magento 1.9.3.6 升级到当前的 magento 2.4.3-p1 。仅要商品、客户和订单数据,模块和模板可不要。

尝试:使用 magento 官方提供的 Data Migration Tool 来迁移数据。大概是先安装新版本的magento2,然后安装Data Migration Tool,再按照操作说明来迁移数据。大概可满足需求。

参考:

magento2 - 提交订单最后一步时出错 - Report ID: webapi - 可能是宝塔站点的“防跨站攻击(open_basedir)”问题

现象:magento2站点,测试时发现提交订单最后一步时报错,如:Details are available in Magento log file. Report ID: webapi-61c539eec7d0c 详细的日志如:

[2021-12-24 03:11:39] main.CRITICAL: Report ID: webapi-61c53a6b7b804; Message: Validate class not found from basename 'MagentoFrameworkValidatorEmailAddress' {"exception":"[object] (Exception(code: 0): Report ID: webapi-61c53a6b7b804; Message: Validate class not found from basename 'Magento\Framework\Validator\EmailAddress' at /www/wwwroot/web1/vendor/magento/framework/Webapi/ErrorProcessor.php:208, Zend_Validate_Exception(code: 0): Validate class not found from basename 'Magento\Framework\Validator\EmailAddress' at /www/wwwroot/web1/vendor/magento/zendframework1/library/Zend/Validate.php:244)"} []
[2021-12-24 03:11:42] main.CRITICAL: Report ID: webapi-61c53a6eb6cea; Message: Validate class not found from basename 'MagentoFrameworkValidatorEmailAddress' {"exception":"[object] (Exception(code: 0): Report ID: webapi-61c53a6eb6cea; Message: Validate class not found from basename 'Magento\Framework\Validator\EmailAddress' at /www/wwwroot/web1/vendor/magento/framework/Webapi/ErrorProcessor.php:208, Zend_Validate_Exception(code: 0): Validate class not found from basename 'Magento\Framework\Validator\EmailAddress' at /www/wwwroot/web1/vendor/magento/zendframework1/library/Zend/Validate.php:244)"} []
[2021-12-24 03:11:43] main.ERROR: BraintreeConfiguration::merchantId needs to be set (or accessToken needs to be passed to BraintreeGateway). [] []

尝试:在宝塔面板的站点管理,网站目录的属性中,不勾选 “防跨站攻击(open_basedir)” 的功能。

dn_magento2-bt-open_basedir.png

参考:https://github.com/magento/magento2/issues/12255

WHM/cPanel 安装 libsodium

问题:WHM/cPanel的面板环境,安装magento2需要php的sodium扩展。

尝试:

  1. 登录到WHM中,打开“终端”
  2. yum -y install epel-release # 安装epel安装源
  3. yum -y install libsodium libsodium-devel # 安装 libsodium
  4. 转到 Module Installers 页,在相应的php版本中,在 PECL 里输入 libsodium ,然后点击 Install Now 安装

参考:https://www.vpsblocks.com.au/support/Knowledgebase/Article/View/411/11/installing-libsodium-on-cpanel-servers

magento2 - An exception was raised while creating “Request”; no instance returned

环境:magento2

现象:访问网站,有的js文件提示拒绝访问。在网站服务器查看相应的js文件不存在,尝试用 php bin/magento setup:static-content:deploy -f 重新生成静态文件等时,提示出错,出错信息如 An exception was raised while creating “Request”; no instance returned

尝试:查看当前服务器是否安装了多个版本的php。如有多个版本的php,请用网站安装时相应版本php来执行命令,如 /usr/bin/php7.2 bin/magento setup:static-content:deploy -f

参考:https://magento.stackexchange.com/questions/256953/an-exception-was-raised-while-creating-request-no-instance-returned

magento2 - 安装报错 - You do not have the SUPER privilege and binary logging is enabled

环境:nginx,php7.3,mysql5.7,magento2.3.4的tgz包。

通过浏览器安装magento2时,报错:You do not have the SUPER privilege and binary logging is enabled (you might want to use the less safe log_bin_trust_function_creators variable)

尝试:以root用户连接到mysql命令台,执行 set global log_bin_trust_function_creators=1;

参考:https://magento.stackexchange.com/questions/144713/magento-2-1-data-migration-super-privilege-error