Fatal error: call to getModelInstance () member function for non-object in /Applications/XAMPP/xamppfiles/htdocs/magento/app/Mage.php on line 463

I install magento 1.9.0.0 and copy htdocts to my xampp, when I run localhost / magento, this error shows I made decisions, but it did not work.

Fatal error: Call to a member function getModelInstance() on a non-object in /Applications/XAMPP/xamppfiles/htdocs/magento/app/Mage.php on line 463 

Here is the script code:

 public static function getModel($modelClass = '', $arguments = array()) { return self::getConfig()->getModelInstance($modelClass, $arguments); } 
+7
php fatal-error magento
source share
5 answers

The problem is with some write permissions. Set write permissions to the following folders app/etc, var and media .

 cd /xampp-folde/htdocs/magento chmod -R 777 app/etc chmod -R 777 var chmod -R 777 media 
+23
source share

If you get this error when trying to access Magento from outside in a script

The solution given here should be considered first before playing with permissions.

Mage::init(); // 1.5+

Mage::app(); // (pretty much anything) below 1.5

+9
source share

What really causes your problem is that your directory and Magento installation files do not have the correct permissions. XAMPP starts Apache as the default daemon user. If you do not want this, you can change it in httpd.conf . This solves the problem without doing anything else.

But you can just change the owner of the files. You should never give everyone access to your files simply by telling chmod 777 . 777 "Your files are a serious security issue if you ever move these files to a production environment.

Instead of running chmod 777 change the owner of the directory with chown . Go to the Magento directory (in your case cd /Applications/XAMPP/xamppfiles/htdocs/magento/ ) and use this command to recursively change the owner of all files and directories to daemon :

sudo chmod -R daemon .

+4
source share

You must first initialize the Magento Framework first:

 /* Store or website code */ $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : ''; /* Run store or run website */ $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store'; Mage::init($mageRunCode, $mageRunType, array()); 
+4
source share

If you are using a custom script, you may have forgotten to install the current store.

<strong> Examples:

 Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); Mage::app()->setCurrentStore('my_store_id'); 

If you do not install the repository, calls to Mage::getModel will result in the specified error.

+4
source share

All Articles