Magento – PHP Fatal error: Call to a member function getBaseMediaPath() on a non-object

magento-1.9

I am on Magento CE 1.9.1.0 – I've successfully installed the sample data as well. I have no issues on my Mac OS X Yosemite however, on my AWS Ubuntu instance, I am getting the following error:

PHP Fatal error:  Call to a member function getBaseMediaPath() on a non-object in /var/www/foobar/app/code/core/Mage/Catalog/Model/Product/Image.php on line 270

Also trying to view the same product in the admin gives me:

PHP Fatal error:  Call to a member function getConfig() on a non-object in /var/www/foobar/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery/Content.php on line 50

I have PHP GD installed and enabled. The var folder and media folders are set to 777.

All caches have been flushed & disabled, all indexes have been re-indexed.

EDIT: I've just turned on System & Exceptions logging. system.log shows:

2014-12-22T13:38:10+00:00 ERR (3): Warning: include(Mage/Catalog/Model/Product/Media/Config.php): failed to open stream: No such file or directory  in /var/www/foobar/lib/Varien/Autoload.php on line 94
2014-12-22T13:38:10+00:00 ERR (3): Warning: include(): Failed opening 'Mage/Catalog/Model/Product/Media/Config.php' for inclusion (include_path='/var/www/foobar/app/code/local:/var/www/foobar/app/code/community:/var/www/foobar/app/code/core:/var/www/foobar/lib:.:/usr/share/php:/usr/share/pear')  in /var/www/foobar/lib/Varien/Autoload.php on line 94

Best Answer

It turns out that the .gitignore file that I found off the net and used was not properly structured. Many directories and files were missing. The fix was to re-download 1.9.1.0 and extract into my Magento directory. Hope this can help someone.

Related Topic