Mage registry key “_singleton/core/resource” already exists in magento

前端 未结 5 1784
执笔经年
执笔经年 2021-01-21 15:22

I am facing this problem on my site Mage registry key \"_singleton/core/resource\" already exists, Please help me how to solve this error.

I have checked the folder and

相关标签:
5条回答
  • 2021-01-21 15:38

    I stumbled upon this problem before, and this was because of the cache. if you could still access the Magento Admin panel, go and flush your Cache Storage (the two main buttons near the top of the System -> Cache Management page).

    You can also refer to this blog post for more help on the cache problem.

    0 讨论(0)
  • 2021-01-21 15:41

    It is very important to clear the Compiler cache and after that turn it on in backend of Magento.

    Clear the cache

    SSH: find ./var/cache -type f -delete FTP: mrm -r ./var/cache ; mkdir ./var/cache


    Disable/Clear Magento compilation

    SSH: php -f shell/compiler.php -- disable php -f shell/compiler.php -- clear FTP: mv ./includes ./includes.unused

    0 讨论(0)
  • 2021-01-21 15:42

    In index.php put this directly after require_once $mageFilename;

    $app = Mage::app();
    $cache = $app->getCache();
    $cache->clean();
    

    Refresh your broken web page, then remove the code.

    0 讨论(0)
  • 2021-01-21 15:52

    I can see this being quite old thread, but I came across similar problem today. I have two observers on catalog_product_prepare_save and catalog_product_save_after, both are triggered in one php execution.

    It turns out we were using methods from ProductObserver.php file (XXXX_Persona_Model_ProductObserver class) as listeners. It worked fine on Windows and Macs, but was failing with similar message on production (Linux). You guessed it - Linux is case sensitive. Correcting file name to Productobserver.php (and class name accordingly) solved the problem for us.

    0 讨论(0)
  • 2021-01-21 15:57

    Put this file in your Magento root folder ie: clear-cache.php and execute it through terminal.

    php /home/magento/www/clear-cache.php

    This will clear all cache and rebuild all indexes.

    Fixed the issue you described in Magento Enterprise 1.11.2 when I could not load any page or get into admin and deleting /var/cache did not fix the issue.

    <?php
    // Include Magento
    require_once dirname(__FILE__).'/app/Mage.php';
    Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
    // Set user admin session
    $userModel = Mage::getModel('admin/user');
    $userModel->setUserId(0);
    Mage::getSingleton('admin/session')->setUser($userModel);
    // Call Magento clean cache action
    Mage::app()->cleanCache();
    // Enable all cache types
    $enable = array();
    foreach(Mage::helper('core')->getCacheTypes() as $type => $label){
        $enable[$type] = 1;
    }
    Mage::app()->saveUseCache($enable);
    // Refresh cache's
    echo 'Refreshing cache...';
    try {
        Mage::getSingleton('catalog/url')->refreshRewrites();
        echo 'Catalog Rewrites was refreshed successfully';
    } catch ( Exception $e ) {
        echo 'Error in Catalog Rewrites: '.$e->getMessage();
    }
    // This one caused an error for me - you can try enable it
    /*try {
        Mage::getSingleton('catalog/index')->rebuild();
        echo 'Catalog Index was rebuilt successfully';
    } catch ( Exception $e ) {
        echo 'Error in Catalog Index: '.$e->getMessage();
    }*/
    try {
        $flag = Mage::getModel('catalogindex/catalog_index_flag')->loadSelf();
        if ( $flag->getState() == Mage_CatalogIndex_Model_Catalog_Index_Flag::STATE_RUNNING ) {
            $kill = Mage::getModel('catalogindex/catalog_index_kill_flag')->loadSelf();
            $kill->setFlagData($flag->getFlagData())->save();
        }
        $flag->setState(Mage_CatalogIndex_Model_Catalog_Index_Flag::STATE_QUEUED)->save();
        Mage::getSingleton('catalogindex/indexer')->plainReindex();
        echo 'Layered Navigation Indices was refreshed successfully';
    } catch ( Exception $e ) {
        echo 'Error in Layered Navigation Indices: '.$e->getMessage();
    }
    try {
        Mage::getModel('catalog/product_image')->clearCache();
        echo 'Image cache was cleared successfully';
    } catch ( Exception $e ) {
        echo 'Error in Image cache: '.$e->getMessage();
    }
    try {
        Mage::getSingleton('catalogsearch/fulltext')->rebuildIndex();
        echo 'Search Index was rebuilded successfully';
    } catch ( Exception $e ) {
        echo 'Error in Search Index: '.$e->getMessage();
    }
    try {
        Mage::getSingleton('cataloginventory/stock_status')->rebuild();
        echo 'CatalogInventory Stock Status was rebuilded successfully';
    } catch ( Exception $e ) {
        echo 'Error in CatalogInventory Stock Status: '.$e->getMessage();
    }
    try {
        Mage::getResourceModel('catalog/category_flat')->rebuild();
        echo 'Flat Catalog Category was rebuilt successfully';
    } catch ( Exception $e ) {
        echo 'Error in Flat Catalog Category: '.$e->getMessage();
    }
    try {
        Mage::getResourceModel('catalog/product_flat_indexer')->rebuild();
        echo 'Flat Catalog Product was rebuilt successfully';
    } catch ( Exception $e ) {
        echo 'Error in Flat Catalog Product: '.$e->getMessage();
    }
    echo 'Cache cleared';
    // Rebuild indexes
    echo 'Rebuilding indexes';
    for ($i = 1; $i <= 9; $i++) {
        $process = Mage::getModel('index/process')->load($i);
        try {
            $process->reindexAll();
        } catch ( Exception $e ) {
            echo 'Error rebuilding index '.$i.': '.$e->getMessage();
        }
    }
    echo 'Indexes rebuilt';
    echo 'Finished!';
    
    0 讨论(0)
提交回复
热议问题