这是我得到的,我不知道该怎么做....
There has been an error processing your request
SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
Trace:
#0 /home/autobadges/public_html/stangcenter.com/lib/Zend/Db/Statement.php(300): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/autobadges/public_html/stangcenter.com/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#2 /home/autobadges/public_html/stangcenter.com/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `main_ta...', Array)
#3 /home/autobadges/public_html/stangcenter.com/lib/Varien/Db/Adapter/Pdo/Mysql.php(333): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `main_ta...', Array)
#4 /home/autobadges/public_html/stangcenter.com/lib/Zend/Db/Adapter/Abstract.php(734): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
#5 /home/autobadges/public_html/stangcenter.com/lib/Varien/Data/Collection/Db.php(783): Zend_Db_Adapter_Abstract->fetchAll(Object(Varien_Db_Select), Array)
#6 /home/autobadges/public_html/stangcenter.com/lib/Varien/Data/Collection/Db.php(696): Varien_Data_Collection_Db->_fetchAll(Object(Varien_Db_Select))
#7 /home/autobadges/public_html/stangcenter.com/lib/Varien/Data/Collection/Db.php(617): Varien_Data_Collection_Db->getData()
#8 /home/autobadges/public_html/stangcenter.com/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs.php(57): Varien_Data_Collection_Db->load()
#9 /home/autobadges/public_html/stangcenter.com/app/code/core/Mage/Core/Block/Abstract.php(223): Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs->_prepareLayout()
#10 /home/autobadges/public_html/stangcenter.com/app/code/core/Mage/Core/Model/Layout.php(430): Mage_Core_Block_Abstract->setLayout(Object(Mage_Core_Model_Layout))
#11 /home/autobadges/public_html/stangcenter.com/app/code/core/Mage/Core/Model/Layout.php(446): Mage_Core_Model_Layout->createBlock('adminhtml/catal...', 'product_tabs')
#12 /home/autobadges/public_html/stangcenter.com/app/code/core/Mage/Core/Model/Layout.php(238): Mage_Core_Model_Layout->addBlock('adminhtml/catal...', 'product_tabs')
#13 /home/autobadges/public_html/stangcenter.com/app/code/core/Mage/Core/Model/Layout.php(204): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#14 /home/autobadges/public_html/stangcenter.com/app/code/core/Mage/Core/Model/Layout.php(209): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#15 /home/autobadges/public_html/stangcenter.com/app/code/core/Mage/Core/Controller/Varien/Action.php(343): Mage_Core_Model_Layout->generateBlocks()
#16 /home/autobadges/public_html/stangcenter.com/app/code/core/Mage/Core/Controller/Varien/Action.php(270): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#17 /home/autobadges/public_html/stangcenter.com/app/code/core/Mage/Adminhtml/Controller/Action.php(263): Mage_Core_Controller_Varien_Action->loadLayout(Array, true, true)
#18 /home/autobadges/public_html/stangcenter.com/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php(246): Mage_Adminhtml_Controller_Action->loadLayout(Array)
#19 /home/autobadges/public_html/stangcenter.com/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_Catalog_ProductController->editAction()
#20 /home/autobadges/public_html/stangcenter.com/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(253): Mage_Core_Controller_Varien_Action->dispatch('edit')
#21 /home/autobadges/public_html/stangcenter.com/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#22 /home/autobadges/public_html/stangcenter.com/app/code/core/Mage/Core/Model/App.php(340): Mage_Core_Controller_Varien_Front->dispatch()
#23 /home/autobadges/public_html/stangcenter.com/app/Mage.php(627): Mage_Core_Model_App->run(Array)
#24 /home/autobadges/public_html/stangcenter.com/index.php(80): Mage::run('', 'store')
#25 {main}
答案 0 :(得分:0)
在try块中编写你的zend查询
和
捕获异常
Zend_Db_Statement_Mysqli_Exception
(检查你使用'mysql'或'mysqli'或'PDO'中的哪一个)在异常捕获代码中调用{model}->getDefaultAdapter()->closeConnection()
,然后再次调用你得到的zend查询。
这可以解决你的问题。
注意:以下代码仅供参考,不应按原样使用(可能有错误)。
try
{
$user = {model}->fetchRow(array('user_id = ?' => $senderid));
}
catch(Zend_Db_Statement_Mysqli_Exception $zenddbmysqliexc)
{
if(stristr($zenddbmysqliexc->getMessage(), 'MySQL server has gone away'))
{
{model}->getDefaultAdapter()->closeConnection();
$user = {model}->fetchRow(array('user_id = ?' => $senderid));
}
}