1

I am facing this error when trying to install magento 2.2.6.

Fatal error: Uncaught Exception: Deprecated Functionality: The each() function is deprecated. This message will be suppressed on further calls in /var/www/html/m226/vendor/colinmollenhour/cache-backend-file/File.php on line 81 in /var/www/html/m226/vendor/magento/framework/App/ErrorHandler.php:61 Stack trace: #0 [internal function]: Magento\Framework\App\ErrorHandler->handler(8192, 'The each() func...', '/var/www/html/m...', 81, Array) #1 /var/www/html/m226/vendor/colinmollenhour/cache-backend-file/File.php(81): each(Array) #2 /var/www/html/m226/vendor/magento/zendframework1/library/Zend/Cache.php(153): Cm_Cache_Backend_File->__construct(Array) #3 /var/www/html/m226/vendor/magento/zendframework1/library/Zend/Cache.php(94): Zend_Cache::_makeBackend('Cm_Cache_Backen...', Array, true, true) #4 /var/www/html/m226/vendor/magento/framework/App/Cache/Frontend/Factory.php(156): Zend_Cache::factory('Magento\Framewo...', 'Cm_Cache_Backen...', Array, Array, true, true, true) #5 /var/www/html/m226/vendor/magento/framework/Cache/Fron in /var/www/html/m226/vendor/magento/framework/App/ErrorHandler.php on line 61

Does anyone have any idea?

asked Mar 14, 2019 at 9:06
3
  • 3
    what php version your system has? please refer this system-requirement Commented Mar 14, 2019 at 9:26
  • 1
    Yes it was a issue of system requirement. I am using php 7.2 and trying to install magento 2.2.6 Commented Mar 14, 2019 at 9:32
  • Do changing the php version doesn't solved your issue? Commented Mar 14, 2019 at 10:31

2 Answers 2

1

The each() function is deprecated in php 7.2 so change this function to foreach() on line no 81.

Change

 while (list($name, $value) = each($options)) {
 $this->setOption($name, $value);
 }

To

foreach ($options as $name => $value){
 $this->setOption($name, $value);
 }

And compile the code using php bin/magento s:d:c I hope this will help you.

Thanks

answered Mar 14, 2019 at 9:13
5
  • No it didnt work. and are we supposed to change file from vendor? Commented Mar 14, 2019 at 9:31
  • @sugar Yes Can you please change and check it? Also, try command php bin/magento s:d:c Commented Mar 14, 2019 at 9:57
  • Nope still no progress Commented Mar 14, 2019 at 10:03
  • Are you made changes in vendor/colinmollenhour/cache-backend-file/File.php line no 81? because it is working fine in my setup. Can you please do this below commnd php bin/magento s:up and php bin/magento s:d:c and clear cache. Commented Mar 14, 2019 at 10:36
  • Also, Please install magento 2.3.0 which is support PHP 7.2 version Commented Mar 14, 2019 at 10:38
0

Magento 2.2 is not fully compatible with php 7.2 use magento 2.3 which is fully support 7.2

answered Sep 19, 2019 at 12:39

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.