Search code examples
phpmagentoxamppspl-autoload-register

error Deprecated: __autoload() is deprecated when transfer site magento 1.9 server to localhost


I've been going crazy for days. I installed Windows Xampp on my PC and I copied my website (the whole folder from FTP) and the database in the htdocs folder.

Furthermore, the file C:\xampp\htdocs\mysite\app\code\core\Mage\Core\Model\Layout.php does not exist, only 3 files called Data, element and update.

I have tried to use spl_autoload_register() instead, but it doesn't work.

Does anyone have any clue of what's wrong?

Deprecated: __autoload() is deprecated, use spl_autoload_register() instead in C:\xampp\htdocs\mysite\app\code\core\Mage\Core\functions.php on line 60

Fatal error: Uncaught Error: Function name must be a string in C:\xampp\htdocs\mysite\app\code\core\Mage\Core\Model\Layout.php:555 Stack trace: 
#0 C:\xampp\htdocs\mysite\app\code\core\Mage\Core\Controller\Varien\Action.php(390): Mage_Core_Model_Layout->getOutput() 
#1 C:\xampp\htdocs\mysite\app\code\core\Mage\Cms\Helper\Page.php(137): Mage_Core_Controller_Varien_Action->renderLayout() 
#2 C:\xampp\htdocs\mysite\app\code\core\Mage\Cms\Helper\Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'home') 
#3 C:\xampp\htdocs\mysite\app\code\core\Mage\Cms\controllers\IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'home') 
#4 C:\xampp\htdocs\mysite\app\code\core\Mage\Core\Controller\Varien\Action.php(418): Mage_Cms_IndexController->indexAction() 
#5 C:\xampp\htdocs\mysite\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index') 
#6 C:\xampp\htdocs\mysite\app\code\core\Mage\Core\Cont in C:\xampp\htdocs\mysite\app\code\core\Mage\Core\Model\Layout.php on line 555

Solution

  • I'm guessing you're using php7.2 on localhost.

    That function is deprecated:

    https://www.php.net/manual/en/migration72.deprecated.php
    

    You should change your PHP version to 5.6 locally for Magento 1.9 (unless you've upgraded it to work with 7.0)

    Try using the same PHP version as you have on the live website.