Search code examples
magentomagento-1.8

Uncaught exception: Mage_Core_Model_Store_Exception


Fatal error:  Uncaught exception 'Mage_Core_Model_Store_Exception' in /home/mywebsite/public_html/app/code/core/Mage/Core/Model/App.php:1357

        Stack trace:
            #0 /home/mywebsite/public_html/app/code/core/Mage/Core/Model/App.php(842): Mage_Core_Model_App->throwStoreException()
            #1 /home/mywebsite/public_html/app/code/core/Mage/Core/Model/App.php(491): Mage_Core_Model_App->getStore()
            #2 /home/mywebsite/public_html/app/code/core/Mage/Core/Model/App.php(274): Mage_Core_Model_App->_initCurrentStore('default', 'store')
            #3 /home/mywebsite/public_html/app/Mage.php(615): Mage_Core_Model_App->init('default', 'store', Array)
            #4 /home/mywebsite/public_html/pricerule.php(6): Mage::app('default')
            #5 {main}

thrown in <b>/home/mywebsite/public_html/app/code/core/Mage/Core/Model/App.php</b> on line <b>1357</b>

This error occurs on this line:

require_once 'app/Mage.php';
  • PDO is enabled
  • I have copied php.ini file in app and downloader directories
  • app, downloader, media and var directories have been set to 777 permissions

These are all suggested solutions for this particular error, but none of them worked for me. Any other suggestions please??


EDIT -- SOLUTION ---------------------

I added the following line after require_once 'app/Mage.php';

require_once 'app/Mage.php';
Mage::app('main');

where 'main' is my store's code. I have only one store in Magento.

I found this solution in another file I'm using which contains require_once 'app/Mage.php' but doesn't give an error. I don't know why it worked, but it did.


Solution

  • I added Mage::app('main'); after require_once 'app/Mage.php';

    require_once 'app/Mage.php'; 
    Mage::app('main');
    

    where 'main' is my store's code. I have only one store in Magento.

    I found this solution in another file I'm using which contains require_once 'app/Mage.php' but doesn't give an error. I don't know why it worked, but it did.