title: Uncaught exception: Mage_Core_Model_Store_Exception
body: <pre><code>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-&amp;gt;throwStoreException()
              #1 /home/mywebsite/public_html/app/code/core/Mage/Core/Model/App.php(491): Mage_Core_Model_App-&amp;gt;getStore()
              #2 /home/mywebsite/public_html/app/code/core/Mage/Core/Model/App.php(274): Mage_Core_Model_App-&amp;gt;_initCurrentStore('default', 'store')
              #3 /home/mywebsite/public_html/app/Mage.php(615): Mage_Core_Model_App-&amp;gt;init('default', 'store', Array)
              #4 /home/mywebsite/public_html/pricerule.php(6): Mage::app('default')
              #5 {main}
  
  thrown in &lt;b&gt;/home/mywebsite/public_html/app/code/core/Mage/Core/Model/App.php&lt;/b&gt; on line &lt;b&gt;1357&lt;/b&gt;
  </code></pre>
  
  <p>This error occurs on this line:</p>
  
  <pre><code>require_once 'app/Mage.php';
  </code></pre>
  
  <ul>
  <li>PDO is enabled</li>
  <li>I have copied php.ini file in app and downloader directories</li>
  <li>app, downloader, media and var directories have been set to 777
  permissions</li>
  </ul>
  
  <p>These are all suggested solutions for this particular error, but none of them worked for me. Any other suggestions please??</p>
  
  <hr>
  
  <h2>EDIT -- SOLUTION ---------------------</h2>
  
  <p>I added the following line after require_once 'app/Mage.php';</p>
  
  <pre><code>require_once 'app/Mage.php';
  Mage::app('main');
  </code></pre>
  
  <p>where 'main' is my store's code. I have only one store in Magento.</p>
  
  <p>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.</p>