我在我的网站上遇到此问题Mage注册表项“_singleton / core / resource”已经存在,请帮我解决此错误。
我已检查文件夹和文件权限
将lib / Zend / Cache / Backend / File.php更改为'cache_dir'=> null,'cache_dir'=> 'TMP',
index.php中的更改注释了行
if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
Mage::setIsDeveloperMode(true);
}
执行这些更改后,它运行良好,今天它再次停止并显示相同的问题
我已经尝试过各种方式,但没有取得成功。
答案 0 :(得分:8)
之前我偶然发现了这个问题,这是因为缓存。如果您仍然可以访问Magento Admin面板,请转到并清除缓存存储(系统顶部附近的两个主要按钮 - >缓存管理页面)。
您还可以参考this blog post获取有关缓存问题的更多帮助。
答案 1 :(得分:3)
清除编译器缓存非常重要,然后在Magento的后端打开它。
SSH: 找到./var/cache -type f -delete FTP: mrm -r ./var/cache; mkdir ./var/cache
SSH: php -f shell / compiler.php - 禁用 php -f shell / compiler.php - 清除 FTP: mv ./includes ./includes.unused
答案 2 :(得分:2)
将此文件放在Magento根文件夹中,即:clear-cache.php
并通过终端执行。
php /home/magento/www/clear-cache.php
这将清除所有缓存并重建所有索引。
修复了我在Magento Enterprise 1.11.2中描述的无法加载任何页面或进入管理员并删除/var/cache
未解决此问题的问题。
<?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!';
答案 3 :(得分:2)
在index.php
中,将其直接放在require_once $mageFilename;
$app = Mage::app();
$cache = $app->getCache();
$cache->clean();
刷新损坏的网页,然后删除代码。
答案 4 :(得分:0)
我可以看到这是一个很老的线程,但我今天遇到了类似的问题。我在catalog_product_prepare_save和catalog_product_save_after上有两个观察者,两个都在一次php执行中被触发。
事实证明我们使用ProductObserver.php文件(XXXX_Persona_Model_ProductObserver类)中的方法作为侦听器。它在Windows和Mac上运行良好,但在生产(Linux)上却出现了类似的消息。你猜对了 - Linux是区分大小写的。将文件名更正为Productobserver.php(以及相应的类名)为我们解决了问题。