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
    Commented Oct 22, 2020 at 8:35
  • @HelgeB Yes, I am using PHP 7.3.23-4+ubuntu18.04.1. But not working. Any help?
    – Bojjaiah
    Commented Oct 22, 2020 at 9:03
  • @HelgeB The same error showing after upgraded PHP 7.4 also.
    – Bojjaiah
    Commented Oct 22, 2020 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
    Commented Oct 22, 2020 at 9:40
  • 1
    So the issue was with incorrect php version used during running magento on web server and now it solved? Commented Oct 23, 2020 at 7:01

3 Answers 3

6

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
    Commented Dec 18, 2020 at 15:18
  • Thanks. working for me Commented Jan 26, 2021 at 11:26
  • Thanks. working for me Commented Apr 14, 2021 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

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 and acknowledge you have read our privacy policy.

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