|
I just ran across an error transferring a Magento site from one host to another and wanted to share the solution here. The fix is fairly simple however the debug process to track down the fix was quite involved.
The Problem:After an export/import of the Magento database I ran into the following two errors when trying to access the site. The first error I ran into after moving the site was the following: Notice: Undefined index: 0 in/app/code/core/Mage/Core/Model/Mysql4/Config.php on line 88
The solution:The solution to this error was to add the following two lines to the top of my sql import file. SET FOREIGN_KEY_CHECKS = 0 ; SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
The first line fixes a common issue with Magento when trying to export/import databases where you get an error about foreign constraints. The second line fixes an issue where associative id's are automatically changed by MySQL which breaks the association.The specific values that get changed and cause this error are: Table = core_store | Values = store_id & website_id The correct values are:
Table = core_website | Values = website_id The correct values are:
Basically the website_id column in core_store must match thewebsite_id column in core_website and the store_id for admin in core_store must be 0. The Second Problem:After fixing the first issue I ran into a second error message as follows: Recoverable Error: Argument 1 passed to Mage_Core_Model_Store::setWebsite() must be an instance of Mage_Core_Model_Website, null given, called in... ...app/code/core/Mage/Core/Model/App.php on line 341 [0] in Mage_Core_Model_Store->setWebsite(NULL) in...
The Second Solution:This is because the id's from the first issue where cached so in short... delete everything in var/cache/ and you should be home free! |