5

I'm having an issue when debugging Magento errors. All stack traces related to errors finish with a 'Class 'Mage' not found' and it doesn't provide any other information.

PHP Fatal error:  Class 'Mage' not found in ***app/code/core/Mage/Core/functions.php on line 244, referer: http://***/catalogsearch/result/?q=jeans

In addition, the error is not logged by exception.log or system.log, but by the server error log.

The problem is that there is an actual error, but it's not being logged by Magento and Apache is logging something that is not complete.

Any idea? Is it probably a problem on the PHP configuration?

1
  • What is the apache error returning?
    – B00MER
    Feb 25, 2014 at 23:26

3 Answers 3

3

It seams like there are no free space on your server and magento cannot write into magento/var folder.

Also try to delete content of /var folder.

7
  • 1
    except var/package.
    – user487772
    Feb 24, 2014 at 18:58
  • Hi, there is 4GB of free space on that directory... so it doesn't seem to be the problem. Any other suggestion?
    – PauGNU
    Feb 25, 2014 at 9:35
  • Did you try to delete var content except package? Feb 25, 2014 at 9:37
  • Hi Oleksii, I don't have that option. All the content that is in that folder has to remain in there (there are links to external folders). FYI, the system.log and exception.log are still being populated by Magento, but not for the errors I mentioned above.
    – PauGNU
    Feb 25, 2014 at 10:23
  • Ok. Can you clarify if magento can write into /var/session. Becaue this error definitely appears when magento cannot write session into /var/session. Reasons could be different. Feb 25, 2014 at 11:11
1
function mageCoreErrorHandler($errno, $errstr, $errfile, $errline){
    // ...
    $errorMessage .= ": {$errstr}  in {$errfile} on line {$errline}";
    if (Mage::getIsDeveloperMode()) { // <--------------- LINE 244
        throw new Exception($errorMessage); 
    } else {
        Mage::log($errorMessage, Zend_Log::ERR);
    }
}

My guess Magento is loaded, Mage.php is normally included around here: index.php:69 but something wents wrong while including Mage.php, e.g. Varien_Autoloader is not found or whatever (is there more in the php log?). Then a error is thrown. Because functions.php is already included, the error handler is used to show the error, but there is although a problem, because Mage is missing.

The problem with this story is, that the error handler is registered in Mage_Core_Model_App and I'm quite sure, that this happens after Mage is loaded.

I thought about deleting everything, but maybe the thoughts helps you debugging.

I would just delete the end of the mageCoreErrorHandler function and echo $errorMessage, then you should see the error.

2
  • Thanks, Fabian. I'll try and let you know. Do you think this could be related to APC somehow? We use memcached as Magento cache, but APC is enabled on the server anyway.
    – PauGNU
    Feb 26, 2014 at 10:33
  • Can be everything, I don't know this error and it is very strange. I'm eager to know what is the problem :-) Feb 26, 2014 at 19:27
1

Does it only happen on your live server or can you replicate the same error on dev/staging?

Did you try to clear var/cache directory and flush APC cache (similar problem could be found at http://www.magentocommerce.com/boards/viewthread/193459/)?

Does it only happen on search page or on other pages as well? If on search could you try replicate the issue by going directly to http:/.../catalogsearch/result without any parameters? Do you use MySQL or SOLR as a search engine?

1
  • Hi Ronwe: this happens on all environments. We use memcached (we have flushed everything, restarted everything, many times). This happens in many different sections on the website, not only search, but also when adding a product to the cart or logging in. Sometimes it depends on the user session. We have tried going back to normal cache instead of Memcached, but... nothing. We use Solr as a search engine, which has been restarted and reindexed many times.
    – PauGNU
    Mar 4, 2014 at 9:38

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.