首页 > 解决方案 > 安装 Magento 2.4.1 和配置后,最后我得到这个错误

问题描述

我发现magento2.4.1版本的安装和配置非常困难。经过一番努力,我设法达到了与 cookie 相关的错误的地步。有人可以帮我吗?

错误在下面重现

1 个例外:
异常 #0 (Magento\Framework\Exception\RuntimeException):创建对象时发生类型错误:Magento\Framework\Session\Generic\Interceptor,setcookie() 期望参数 3 为整数,给定数组

异常 #0 (Magento\Framework\Exception\RuntimeException):创建对象时发生类型错误:Magento\Framework\Session\Generic\Interceptor,setcookie() 期望参数 3 为整数,给定数组
#1 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Framewor...') 在 [vendor/magento/framework/ObjectManager/ObjectManager.php:70] 调用
#2 Magento\Framework\ObjectManager\ObjectManager->get('Magento\Framewor...') 在 [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:170] 调用
#3 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(array('instance' => 'Magento\Framewor...'), 'Magento\Framewor...', NULL, 'session', 'Magento\ Framewor...') 在 [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:276] 调用
#4 Magento\Framework\ObjectManager\Factory\AbstractFactory->getResolvedArgument('Magento\Framewor...', array('session', 'Magento\Framewor...', true, NULL, false), array())在 [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:239] 调用
#5 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime('Magento\Framewor...', array(array('mathRandom', 'Magento\Framewor...', true, NULL, false), array( 'session', 'Magento\Framewor...', true, NULL, false), array('escaper', 'Magento\Framewor...', true, NULL, false)), array()) 在 [供应商/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:34]
#6 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\Framewor...', array(array('mathRandom', 'Magento\Framewor...', true, NULL, false), array('session', 'Magento\Framewor...', true, NULL, false), array('escaper', 'Magento\Framewor...', true, NULL, false)), array()) 调用在 [供应商/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:59]
#7 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Framewor...') 在 [vendor/magento/framework/ObjectManager/ObjectManager.php:70] 调用
#8 Magento\Framework\ObjectManager\ObjectManager->get('Magento\Framewor...') 在 [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:170] 调用
#9 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(array('instance' => 'Magento\Framewor...'), 'Magento\Framewor...', NULL, 'formKey', 'Magento\ Framewor...') 在 [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:276] 调用
#10 Magento\Framework\ObjectManager\Factory\AbstractFactory->getResolvedArgument('Magento\Framewor...', array('formKey', 'Magento\Framewor...', true, NULL, false), array())在 [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:239] 调用
#11 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime('Magento\Framewor...', array(array('formKey', 'Magento\Framewor...', true, NULL, false)), 数组()) 在 [vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:34] 调用
#12 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\Framewor...', array(array('formKey', 'Magento\Framewor...', true, NULL, false)) , array()) 在 [vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:59] 调用
#13 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Framewor...') 在 [vendor/magento/framework/ObjectManager/ObjectManager.php:70] 调用
#14 Magento\Framework\ObjectManager\ObjectManager->get('Magento\Framewor...') 在 [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:170] 调用
#15 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(array('instance' => 'Magento\Framewor...'), 'Magento\Framewor...', NULL, 'formKeyValidator', 'CsrfRequestValid. ..') 在 [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:276] 调用
#16 Magento\Framework\ObjectManager\Factory\AbstractFactory->getResolvedArgument('CsrfRequestValid...', array('formKeyValidator', 'Magento\Framewor...', true, NULL, false), array()) 调用于[供应商/magento/framework/ObjectManager/Factory/AbstractFactory.php:239]
#17 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime('CsrfRequestValid...', array('formKeyValidator', 'Magento\Framewor...', true, NULL, false), array('redirectFactory ', 'Magento\Framewor...', true, NULL, false), array('appState', 'Magento\Framewor...', true, NULL, false)), array()) 在 [vendor/ magento/framework/ObjectManager/Factory/Dynamic/Developer.php:34]
#18 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('CsrfRequestValid...', array(array('formKeyValidator', 'Magento\Framewor...', true, NULL, false), array( 'redirectFactory', 'Magento\Framewor...', true, NULL, false), array('appState', 'Magento\Framewor...', true, NULL, false)), array()) 在 [供应商/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:59]
#19 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('CsrfRequestValid...') 在 [vendor/magento/framework/ObjectManager/ObjectManager.php:70] 调用
#20 Magento\Framework\ObjectManager\ObjectManager->get('CsrfRequestValid...') 在 [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:206] 调用
#21 Magento\Framework\ObjectManager\Factory\AbstractFactory->parseArray(array('csrf_validator' => array('instance' => 'CsrfRequestValid...'), 'http_method_vali...' => array('instance' => 'Magento\Framewor...'))) 在 [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:182] 调用
#22 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(array('csrf_validator' => array('instance' => 'CsrfRequestValid...'), 'http_method_vali...' => array('instance' => 'Magento\Framewor...')), NULL, NULL, 'validators', 'RequestValidator') 在 [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:276] 调用
#23 Magento\Framework\ObjectManager\Factory\AbstractFactory->getResolvedArgument('RequestValidator', array('validators', NULL, true, NULL, false), array('validators' => array('csrf_validator' => array( 'instance' => 'CsrfRequestValid...'), 'http_method_vali...' => array('instance' => 'Magento\Framewor...')))) 在 [vendor/magento/framework/ObjectManager /Factory/AbstractFactory.php:239]
#24 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime('RequestValidator', array(array('validators', NULL, true, NULL, false)), array('validators' => array('csrf_validator' = > array('instance' => 'CsrfRequestValid...'), 'http_method_vali...' => array('instance' => 'Magento\Framewor...')))) 在 [vendor/magento/框架/ObjectManager/Factory/Dynamic/Developer.php:34]
#25 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('RequestValidator', array(array('validators', NULL, true, NULL, false)), array('validators' => array('csrf_validator ' => array('instance' => 'CsrfRequestValid...'), 'http_method_vali...' => array('instance' => 'Magento\Framewor...')))) 在 [vendor/ magento/framework/ObjectManager/Factory/Dynamic/Developer.php:59]
#26 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('RequestValidator') 在 [vendor/magento/framework/ObjectManager/ObjectManager.php:70] 调用
#27 Magento\Framework\ObjectManager\ObjectManager->get('RequestValidator') 在 [vendor/magento/framework/App/FrontController.php:86] 调用
#28 Magento\Framework\App\FrontController->__construct(&Magento\Framework\App\RouterList#000000002ddc016a00000000179c2cee#, &Magento\Framework\App\Response\Http\Interceptor#000000002ddc075100000000179c2cee#, NULL, NULL, NULL, NULL) 调用在 [生成/代码/Magento/Framework/App/FrontController/Interceptor.php:14]
#29 Magento\Framework\App\FrontController\Interceptor->__construct(&Magento\Framework\App\RouterList#000000002ddc016a00000000179c2cee#, &Magento\Framework\App\Response\Http\Interceptor#000000002ddc075100000000179c2cee#, NULL, NULL, ) 在 [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121] 调用
#30 Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\Framewor...', array(&Magento\Framework\App\RouterList#000000002ddc016a00000000179c2cee#, &Magento\Framework\App\Response\Http\Interceptor#000000002ddc075100000000010000000007c2cee# #, NULL, NULL, NULL, NULL, NULL)) 在 [vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:66] 调用
#31 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Framewor...') 在 [vendor/magento/framework/ObjectManager/ObjectManager.php:70] 调用
#32 Magento\Framework\ObjectManager\ObjectManager->get('Magento\Framewor...') 在 [vendor/magento/framework/App/Http.php:115] 调用
#33 Magento\Framework\App\Http->launch() 在 [generated/code/Magento/Framework/App/Http/Interceptor.php:23] 调用
#34 Magento\Framework\App\Http\Interceptor->launch() 在 [vendor/magento/framework/App/Bootstrap.php:263] 调用
#35 Magento\Framework\App\Bootstrap->run(&Magento\Framework\App\Http\Interceptor#000000002ddc073c00000000179c2cee#) 在 [index.php:39] 调用

标签: phpmagento2

解决方案


终于解决了。这是php版本的问题。我的机器上有 php 7.4,但没有启用。我这样做是为了使 7.4 默认。

禁用现有版本 sudo a2dismod php7.2 systemctl restart apache2 启用新版本 sudo a2enmod php7.4 systemctl restart apache2

终于看到首页了!


推荐阅读