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?
-
3what php version your system has? please refer this system-requirementAbhishek Tripathi– Abhishek Tripathi2019年03月14日 09:26:06 +00:00Commented Mar 14, 2019 at 9:26
-
1Yes it was a issue of system requirement. I am using php 7.2 and trying to install magento 2.2.6surbhi agr– surbhi agr2019年03月14日 09:32:12 +00:00Commented Mar 14, 2019 at 9:32
-
Do changing the php version doesn't solved your issue?Abhishek Tripathi– Abhishek Tripathi2019年03月14日 10:31:56 +00:00Commented 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.
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
-
No it didnt work. and are we supposed to change file from vendor?surbhi agr– surbhi agr2019年03月14日 09:31:04 +00:00Commented Mar 14, 2019 at 9:31
-
@sugar Yes Can you please change and check it? Also, try command php bin/magento s:d:cMoin Malek– Moin Malek2019年03月14日 09:57:23 +00:00Commented Mar 14, 2019 at 9:57
-
Nope still no progresssurbhi agr– surbhi agr2019年03月14日 10:03:26 +00:00Commented 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– Moin Malek2019年03月14日 10:36:23 +00:00Commented Mar 14, 2019 at 10:36
-
Also, Please install magento 2.3.0 which is support PHP 7.2 versionMoin Malek– Moin Malek2019年03月14日 10:38:20 +00:00Commented 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