3

After clear/setting/configuring so many errors & configurations installed the Magento V2.4.1 successfully, now getting below errors.

Type Error occurred when creating object: Magento\Framework\Session\Generic\Interceptor, setcookie() expects parameter 3 to be integer, array given

and

Type Error occurred when creating object: Magento\Backend\Model\Auth\Session\Interceptor, setcookie() expects parameter 3 to be integer, array given

I have ran the instance both PHP7.3 and PHP7.4 but getting same error. First time in the browser showing website, If I navigate any other page getting error continuously.

enter image description here

Continuously getting error and unable to open the backend and store front.

enter image description here

Help on this?

8
  • 2
    The error might be related to your php version, if you use a version >= 7.3 the error shouldn't occur.since the signature of setcookie with the third parameter of type array was added in php version 7.3 – HelgeB Oct 22 '20 at 8:35
  • @HelgeB Yes, I am using PHP 7.3.23-4+ubuntu18.04.1. But not working. Any help? – Bojjaiah Oct 22 '20 at 9:03
  • @HelgeB The same error showing after upgraded PHP 7.4 also. – Bojjaiah Oct 22 '20 at 9:25
  • 1
    does phpversion() returns the same version if you call it from CLI and via URL? What webserver do you use? If it's apache and you are using mod-php you should check that too – HelgeB Oct 22 '20 at 9:40
  • 1
    So the issue was with incorrect php version used during running magento on web server and now it solved? – Ihor Sviziev Oct 23 '20 at 7:01
5

Just had this problem on a server. It was solved after I changed the nginx config to (before it was 7.2):

upstream fastcgi_backend { server unix:/var/run/php/php7.4-fpm.sock; }

And restarted nginx..

3
  • its works for me – matinict Dec 18 '20 at 15:18
  • Thanks. working for me – Deepak Shinde Jan 26 at 11:26
  • Thanks. working for me – Sumit Verma Apr 14 at 15:30
1

The issue is occurred due to the PHP older version. Check the PHP version print phpversion();.

Disable older version

sudo a2dismod php7.x

Enable PHP 7.4

sudo a2enmod php7.4

and restart apache2

sudo systemctl restart apache2

It's working good in my case

0

I think this answer will help you. After upgrade to PHP 7.4, you need to run setup upgrade and compile again. https://community.magento.com/t5/Magento-2-x-Technical-Issues/Magento-2-4-0-gt-2-4-1-Interceptor-Exception-After-Upgrade/td-p/461985

0

Use below commands and check

php bin/magento setup:di:compile rm -rf generated/code/ var/view_preprocessed/ var/page_cache

php bin/magento cache:clean php bin/magento cache:flush

Hope, your error will be solved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.