0

Throwing error while moving Magento 1 website on php 7 configured server.

Fatal error: Uncaught Error: Function name must be a string in /home/mcs/html/sitemain/dev/app/code/core/Mage/Core/Model/Layout.php:555 Stack trace: #0 /home/mcs/html/sitemain/dev/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput() #1 /home/mcs/html/sitemain/dev/app/code/core/Mage/Cms/Helper/Page.php(137): Mage_Core_Controller_Varien_Action->renderLayout() #2 /home/mcs/html/sitemain/dev/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'no-route') #3 /home/mcs/html/sitemain/dev/app/code/core/Mage/Cms/controllers/IndexController.php(75): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'no-route') #4 /home/mcs/html/sitemain/dev/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Cms_IndexController->noRouteAction() #5 /home/mcs/html/sitemain/dev/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('noRoute') #6 /home/mcs/html/sitem in /home/mcs/html/sitemain/dev/app/code/core/Mage/Core/Model/Layout.php on line 555

Teja Bhagavan Kollepara
  • 3,816
  • 5
  • 32
  • 69
Yogesh Trivedi
  • 2,834
  • 4
  • 19
  • 25

1 Answers1

2

Magento 1.9 on PHP 7 is bit tricky to install because php 7 fully does not support Magento 1 and therefore when you install or move site on php 7 configured server it will show you blank screen, you will see above error when you enable the error reporting to 1 in index.php or in php.ini.

Enable error reporting:

ini_set('display_errors', 1);

That error comes because of syntax changes in php 7 which is deprecated, here is solution to this error.

SOLUTIONS

You need to override app/code/core/Mage/Core/Model/Layout.php Line no 555

$out .= $this->getBlock($callback[0])->$callback1;

Replace or write override function for below line

$out .= $this->getBlock($callback[0])->{$callback[1]}();

This will fix your error for sure.

Yogesh Trivedi
  • 2,834
  • 4
  • 19
  • 25
  • Looks like you've answered your own question, but there's a module written by inchoo that tries to fix all the PHP7 compatibility issues https://github.com/Inchoo/Inchoo_PHP7 – Richard Aug 04 '16 at 10:30
  • solution is to use search here, to find out that php7 upgrade was 6 months ago... – MagenX Aug 04 '16 at 11:03
  • @MagenX what do you mean? There is no upgrade for M1 to go to PHP 7. – benmarks Aug 04 '16 at 11:54
  • hm, i mean that lots of people already tried to use M1 with php7 long time ago, thats why we have this question: http://magento.stackexchange.com/questions/74008/is-magento-ready-for-php-7 :) php7 upgrade, not the M1 to php7 upgrade.... – MagenX Aug 04 '16 at 12:37
  • Yes, i just checked inchoo extension for php7, its interesting https://github.com/Inchoo/Inchoo_PHP7/tree/master/app/code/local/Inchoo/PHP7 – Yogesh Trivedi Aug 04 '16 at 22:41
  • Clearing the cache after installing Inchoo_PHP7 resolved the issue. – Anna Völkl Mar 21 '17 at 12:54