I have a problem with one particular site that throws this error periodically

Fatal error: Cannot override final method Mage_Core_Model_Abstract::clearInstance() in app/code/core/Mage/Catalog/Model/Product.php on line 39

I clear cache : Didn't work I restart apache : Site comes back.

EDIT: I am getting the same error in Admin in the products section as well.

I am not running memecache or REDIS or APC

PHP Version 5.3.29

Apache/2.2.29 (Amazon)


  • please look at your phpinfo() call and show for apc/opcache/xdebug and versions of each of them + the version of php and if you run php in fastcgi or as apache module, in case of the second please provide also the apache version
    – Flyingmana
    Nov 22, 2014 at 2:46
  • Please make sure you don't have a Mage folder in your local codepool. If you have overrides that way it could be causing something like this
    – Navarr
    Nov 24, 2014 at 18:20

4 Answers 4


If the error goes away when Apache is restarted, its one of two things.

Either you are using an Apache caching module (unlikely) or you are using mod_php with an opcode cache (eg. APC).

I would assume the latter, and that you have disabled mtime/stat checking in the opcode cache. The end result being an issue that arises, but doesn't clear until the opcode cache is flushed (which a restart of Apache would do).

If you are using APC, try setting,

  • We are not using APC. This is a fresh build AWS Server Nov 20, 2014 at 15:17
  • @brentwpeterson Fresh build AWS means nothing as far whether you're using APC or not. What's on the server and what does your stack look like? What does phpinfo report? There is a lot of precedent pointing to APC on this specific error, like this one: stackoverflow.com/questions/21434830/…
    – davidalger
    Nov 20, 2014 at 16:35
  • @davidalger I know I never installed or configured APC, but I will check to see if it was some how spun up Nov 20, 2014 at 16:37

Have you inspected the code base? Based on the error I'd be worried there have been some core modifications. You didn't mention what version of magento but here are line 35-40 from 1.9

* @package Mage_Catalog
* @author Magento Core Team <[email protected]>
class Mage_Catalog_Model_Product extends Mage_Catalog_Model_Abstract

The error message "Cannot override final method" means that a child class is attempting to overload a parent method but it's been "protected" by marking it as final.

Here's an example:

php > class Foo { final public function hello(){} }
php > class Bar extends Foo { public function hello() {}} 

Fatal error: Cannot override final method Foo::hello() in php shell code on line 1

You should definitely check the core code against the appropriate version for any core modifications. If it's something that recently happened without someone with access deploying code then I'd worry that the server or application has been compromised.

  • This is a new upgrade to 1.9 and I copied in ALL files from 1.9 over the previous version of 1.7. I will do a diff and check Nov 22, 2014 at 12:52
  • a simple copy lets assume, you did not remove files, which are not existent anymore in 1.9 (yes, magento also deletes some stuff from time to time)
    – Flyingmana
    Nov 22, 2014 at 15:14

One thing I noticed in your phpinfo() output: '--cache-file=../config.cache' & both mod_cache and mod_disk_cache are being loaded in Apache.

A quick way to tell if either is the culprit: disable both modules and restart Apache and determine if the issue still persists.

If confirmed I would inspect the contents of the config.cache file used during the build of Apache, and all Apache related configuration options around these two modules, like the cacheroot directive:

Also be aware of the Linux AMI version of updates. According to Amazon, all security patches are automatically applied upon boot of the server. Keep in mind Amazon Linux is a fork and may not be identical to other forks. If I'm not mistaken its based off CentOS.

So a full restart may patch any other outstanding issues that may be relevant for example:

It may not hurt as well to check PHP's realpath cache:


Possibly related with other details:


In got the same error. It was related to an issue in one extension where a MySQL query failed (fatal error) but somehow APC masked the error and only the error message: 'Cannot override final method Mage_Core_Model_Abstract::clearInstance()' was thrown.

The block of the extension that caused the issue was using Magento cache functionality and APC was installed on the server. Once I corrected the MySQL issue I had to refresh APC cache by adding the following line at the beginning of the index.php file:


That did the trick. Hope this helps someone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.