标签 magento 下的文章

magento - inventory_stock_1 doest exist - 导入数据库时需注意用户权限

现象:在原网站,以mysql的root用户,通过mysqldump导出magento2的数据库文件。将导出的数据库文件导入到cPanel空间的数据库。访问cPanel空间的站点,提示出错:

2 exception(s):
Exception #0 (Zend_Db_Statement_Exception): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'aqtest.inventory_stock_1' doesn't exist, query was: SELECT COUNT(DISTINCT e.entity_id) FROM `catalog_product_entity` AS

尝试:编辑导出的magento2数据库文件,将原

DEFINER=`root`@`localhost`

替换为现数据库用户,如

DEFINER=`aqtest`@`localhost`

,最后重新导入。

参考:https://magento.stackexchange.com/questions/259534/inventory-stock-1-doest-exist-on-magento-2-3

cpanel - 用不同的版本的php命令 - /opt/cpanel/ea-php72/root/usr/bin/php - An exception was raised while creating "Request"

现象:在cPanel环境中执行magento2的命令,如 php bin/magento cache:flush提示出错:

An exception was raised while creating "Request"; no instance returned

尝试:用正确的php版本路径再次执行,如 /opt/cpanel/ea-php72/root/usr/bin/php bin/magento cache:flush

参考:

magento - Invalid Form Key. Please refresh the page 错误 - 增大 max_input_vars 值

问题:新安装的magento2.3,在网站后台添加多个产品属性的新商品时,出错,提示 Invalid Form Key. Please refresh the page。环境是apache2.4和php。

尝试:

1.查看web错误日志,有如:

PHP Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0

2.更改php.ini中的 max_input_vars 的值到两万(默认是1000),如 max_input_vars = 20000

3.重启web服务

参考:https://www.simicart.com/blog/magento-2-invalid-form-key/

magento2 - 访问网站默认页404 - Flush magento cache

现象:浏览器访问域名,magento2站点出现页头,但主要内容显示404。用wget测试,也是返回404。但域名后加index.php正常。

尝试:

  1. 登录到magento站点后台,提示 One or more of the Cache Types are invalidated: Configuration, Page Cache. Please go to Cache Management and refresh cache types.
  2. system > cache management > 点击 Flush magento cache

之后访问域名,正常显示首页内容了。

参考:https://magento.stackexchange.com/questions/137362/cache-types-are-invalidated