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?

  • 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
    – surbhi agr
    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


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


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


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.


  • No it didnt work. and are we supposed to change file from vendor?
    – surbhi agr
    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
    – Moin Malek
    Commented Mar 14, 2019 at 9:57
  • Nope still no progress
    – surbhi agr
    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.
    – Moin Malek
    Commented Mar 14, 2019 at 10:36
  • Also, Please install magento 2.3.0 which is support PHP 7.2 version
    – Moin Malek
    Commented Mar 14, 2019 at 10:38

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

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.