CakePHP and Phinx addForeignKey fails, duplicate column - cakephp-3.0

I'm trying to create a migration to add a foreign key to an existing column, it looks like this:
use Migrations\AbstractMigration;
class AddForeignKeyIndexToPoints extends AbstractMigration
{
public function up()
{
$this->table('points')
->addForeignKey('point_type_id', 'point_types', ['id'])
->save();
}
public function down() {
}
}
which fails like this:
== 20170202112138 AddPointTypeToPoints: migrating
Exception: SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'point_type_id' in [C:\Users\Toby\Documents\projects\map\cake\vendor\robmorgan\phinx\src\Phinx\Db\Adapter\PdoAdapter.php, line 306]
2017-02-03 11:12:01 Error: [PDOException] SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'point_type_id'
Stack Trace:
#0 C:\Users\Toby\Documents\projects\map\cake\vendor\robmorgan\phinx\src\Phinx\Db\Adapter\PdoAdapter.php(306): PDO->exec('ALTER TABLE `po...')
#1 C:\Users\Toby\Documents\projects\map\cake\vendor\robmorgan\phinx\src\Phinx\Db\Adapter\MysqlAdapter.php(408): Phinx\Db\Adapter\PdoAdapter->execute('ALTER TABLE `po...')
#2 C:\Users\Toby\Documents\projects\map\cake\vendor\cakephp\migrations\src\CakeAdapter.php(480): Phinx\Db\Adapter\MysqlAdapter->addColumn(Object(Migrations\Table), Object(Phinx\Db\Table\Column))
#3 C:\Users\Toby\Documents\projects\map\cake\vendor\robmorgan\phinx\src\Phinx\Db\Table.php(625): Migrations\CakeAdapter->addColumn(Object(Migrations\Table), Object(Phinx\Db\Table\Column))
#4 C:\Users\Toby\Documents\projects\map\cake\vendor\cakephp\migrations\src\Table.php(81): Phinx\Db\Table->update()
#5 C:\Users\Toby\Documents\projects\map\cake\vendor\robmorgan\phinx\src\Phinx\Db\Table.php(662): Migrations\Table->update()
#6 C:\Users\Toby\Documents\projects\map\cake\config\Migrations\20170202112138_AddPointTypeToPoints.php(17): Phinx\Db\Table->save()
#7 C:\Users\Toby\Documents\projects\map\cake\vendor\robmorgan\phinx\src\Phinx\Migration\Manager\Environment.php(117): AddPointTypeToPoints->up()
#8 C:\Users\Toby\Documents\projects\map\cake\vendor\robmorgan\phinx\src\Phinx\Migration\Manager.php(309): Phinx\Migration\Manager\Environment->executeMigration(Object(AddPointTypeToPoints), 'up')
#9 C:\Users\Toby\Documents\projects\map\cake\vendor\robmorgan\phinx\src\Phinx\Migration\Manager.php(285): Phinx\Migration\Manager->executeMigration('default',Object(AddPointTypeToPoints), 'up')
#10 C:\Users\Toby\Documents\projects\map\cake\vendor\robmorgan\phinx\src\Phinx\Console\Command\Migrate.php(113): Phinx\Migration\Manager->migrate('default', NULL)
#11 C:\Users\Toby\Documents\projects\map\cake\vendor\cakephp\migrations\src\ConfigurationTrait.php(165): Phinx\Console\Command\Migrate->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 C:\Users\Toby\Documents\projects\map\cake\vendor\cakephp\migrations\src\Command\Migrate.php(58): Migrations\Command\Migrate->parentExecute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 C:\Users\Toby\Documents\projects\map\cake\vendor\symfony\console\Command\Command.php(255): Migrations\Command\Migrate->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 C:\Users\Toby\Documents\projects\map\cake\vendor\symfony\console\Application.php(829): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 C:\Users\Toby\Documents\projects\map\cake\vendor\symfony\console\Application.php(191): Symfony\Component\Console\Application->doRunCommand(Object(Migrations\Command\Migrate), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 C:\Users\Toby\Documents\projects\map\cake\vendor\symfony\console\Application.php(122): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 C:\Users\Toby\Documents\projects\map\cake\vendor\cakephp\migrations\src\Shell\MigrationsShell.php(98): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput))
#18 [internal function]: Migrations\Shell\MigrationsShell->main('migrations', 'migrate')
#19 C:\Users\Toby\Documents\projects\map\cake\vendor\cakephp\cakephp\src\Console\Shell.php(466): call_user_func_array(Array, Array)
#20 C:\Users\Toby\Documents\projects\map\cake\vendor\cakephp\migrations\src\Shell\MigrationsShell.php(130): Cake\Console\Shell->runCommand(Array, true, Array)
#21 C:\Users\Toby\Documents\projects\map\cake\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php(227): Migrations\Shell\MigrationsShell->runCommand(Array,true, Array)
#22 C:\Users\Toby\Documents\projects\map\cake\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php(182): Cake\Console\ShellDispatcher->_dispatch(Array)
#23 C:\Users\Toby\Documents\projects\map\cake\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php(128): Cake\Console\ShellDispatcher->dispatch(Array)
#24 C:\Users\Toby\Documents\projects\map\cake\bin\cake.php(34): Cake\Console\ShellDispatcher::run(Array)
#25 {main}
There's at least one example in the Phinx docs that leads me to believe this should work, but I can't get it to - what am I doing wrong?

Related

Exception 'ReflectionException' with message 'Class ingelby\toolbox\helpers\PublicIdBehavior does not exist' in yii2 advance

i am getting this error.
Exception 'ReflectionException' with message 'Class ingelby\toolbox\helpers\PublicIdBehavior does not exist'
in D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\di\Container.php:428
Stack trace:
#0 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\di\Container.php(428): ReflectionClass->__construct('ingelby\\toolbox...')
#1 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\di\Container.php(364): yii\di\Container->getDependencies('ingelby\\toolbox...')
#2 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\di\Container.php(156): yii\di\Container->build('ingelby\\toolbox...', Array, Array)
#3 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\BaseYii.php(349): yii\di\Container->get('ingelby\\toolbox...', Array, Array)
#4 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\base\Component.php(750): yii\BaseYii::createObject(Array)
#5 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\base\Component.php(734): yii\base\Component->attachBehaviorInternal(2, Array)
#6 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\base\Component.php(603): yii\base\Component->ensureBehaviors()
#7 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\db\BaseActiveRecord.php(925): yii\base\Component->trigger('init')
#8 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\base\BaseObject.php(109): yii\db\BaseActiveRecord->init()
#9 [internal function]: yii\base\BaseObject->__construct(Array)
#10 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\di\Container.php(375): ReflectionClass->newInstanceArgs(Array)
#11 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\di\Container.php(156): yii\di\Container->build('frontend\\models...', Array, Array)
#12 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\BaseYii.php(345): yii\di\Container->get('frontend\\models...', Array)
#13 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\base\StaticInstanceTrait.php(37): yii\BaseYii::createObject('frontend\\models...')
#14 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\db\ActiveQuery.php(447): yii\base\Model::instance()
#15 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\db\ActiveQuery.php(146): yii\db\ActiveQuery->buildJoinWith()
#16 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\db\QueryBuilder.php(227): yii\db\ActiveQuery->prepare(Object(yii\db\mysql\QueryBuilder))
#17 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\db\ActiveQuery.php(316): yii\db\QueryBuilder->build(Object(yii\db\ActiveQuery))
#18 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\db\Query.php(237): yii\db\ActiveQuery->createCommand(Object(yii\db\Connection))
#19 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\db\ActiveQuery.php(133): yii\db\Query->all(NULL)
#20 D:\xamppnew\htdocs\nfsp\frontend\models\Event.php(86): yii\db\ActiveQuery->all()
#21 D:\xamppnew\htdocs\nfsp\frontend\controllers\SiteController.php(212): frontend\models\Event::getEvents(Array, 50976)
#22 [internal function]: frontend\controllers\SiteController->actionIndex()
#23 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array)
#24 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\base\Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#25 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\base\Module.php(528): yii\base\Controller->runAction('', Array)
#26 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\web\Application.php(103): yii\base\Module->runAction('', Array)
#27 D:\xamppnew\htdocs\nfsp\vendor\yiisoft\yii2\base\Application.php(386): yii\web\Application->handleRequest(Object(yii\web\Request))
#28 D:\xamppnew\htdocs\nfsp\frontend\web\index.php(18): yii\base\Application->run()
#29 {main}
please help me to solve this problem.
It looks like you are missing a package in a folder vendor.
Try to execute command "composer install".
if it doesn’t help, show please composer.

Changing Magento database

I have installed magento 1.7 with the database name magento1.7 and now I want to replace this with current live dump with the name magento.
I have changed dbnames in local.xml and config.xml,cleared cache and other things in magento. But now I am getting the below error when i load my magento local.
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '921923' for key 'PRIMARY'
Trace:
#0 /Applications/XAMPP/xamppfiles/htdocs/magento/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /Applications/XAMPP/xamppfiles/htdocs/magento/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /Applications/XAMPP/xamppfiles/htdocs/magento/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /Applications/XAMPP/xamppfiles/htdocs/magento/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `lo...', Array)
#4 /Applications/XAMPP/xamppfiles/htdocs/magento/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `lo...', Array)
#5 /Applications/XAMPP/xamppfiles/htdocs/magento/lib/Zend/Db/Adapter/Abstract.php(574): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `lo...', Array)
#6 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Log/Model/Resource/Visitor.php(174): Zend_Db_Adapter_Abstract->insert('log_visitor_inf...', Array)
#7 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Log/Model/Resource/Visitor.php(108): Mage_Log_Model_Resource_Visitor->_saveVisitorInfo(Object(Mage_Log_Model_Visitor))
#8 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(463): Mage_Log_Model_Resource_Visitor->_afterSave(Object(Mage_Log_Model_Visitor))
#9 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_Log_Model_Visitor))
#10 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Log/Model/Visitor.php(167): Mage_Core_Model_Abstract->save()
#11 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Model/App.php(1338): Mage_Log_Model_Visitor->initByRequest(Object(Varien_Event_Observer))
#12 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Log_Model_Visitor), 'initByRequest', Object(Varien_Event_Observer))
#13 /Applications/XAMPP/xamppfiles/htdocs/magento/app/Mage.php(447): Mage_Core_Model_App->dispatchEvent('controller_acti...', Array)
#14 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(528): Mage::dispatchEvent('controller_acti...', Array)
#15 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Controller/Front/Action.php(64): Mage_Core_Controller_Varien_Action->preDispatch()
#16 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(408): Mage_Core_Controller_Front_Action->preDispatch()
#17 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#18 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#19 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#20 /Applications/XAMPP/xamppfiles/htdocs/magento/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#21 /Applications/XAMPP/xamppfiles/htdocs/magento/index.php(87): Mage::run('', 'store')
I searched in the log tables for the value "921923" but couldn't able to find any match. Can someone help/guide me to resolve this issue?
SET FOREIGN_KEY_CHECKS=0;
this then import and delete all value in log_visitor_inf.. tables then its run your website. Delete this folder var then check the website.

Magento Error: After Theme upload on Magento 1.9

Just uploaded a new theme and now get the error. I cannot access the website as well as the backend.
Here is the log:
Trace:
#0 /home/xxxxxx/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/xxxxxx/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/xxxxxx/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /home/xxxxxx/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `main_ta...', Array)
#4 /home/xxxxxx/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `main_ta...', Array)
#5 /home/xxxxxx/public_html/lib/Zend/Db/Adapter/Abstract.php(737): Varien_Db_Adapter_Pdo_Mysql->query('SELECT `main_ta...', Array)
#6 /home/xxxxxx/public_html/lib/Varien/Data/Collection/Db.php(734): Zend_Db_Adapter_Abstract->fetchAll('SELECT `main_ta...', Array)
#7 /home/xxxxxx/public_html/app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php(521): Varien_Data_Collection_Db->_fetchAll('SELECT `main_ta...', Array)
#8 /home/xxxxxx/public_html/lib/Varien/Data/Collection/Db.php(566): Mage_Core_Model_Resource_Db_Collection_Abstract->getData()
#9 /home/xxxxxx/public_html/lib/Varien/Data/Collection.php(741): Varien_Data_Collection_Db->load()
#10 /home/xxxxxx/public_html/app/code/local/Magentothem/Revslider/Helper/Data.php(617): Varien_Data_Collection->getIterator()
#11 /home/xxxxxx/public_html/app/code/local/Magentothem/Revslider/Helper/Data.php(634): Magentothem_Revslider_Helper_Data->getAllCaptionInSlide()
#12 /home/xxxxxx/public_html/app/code/local/Magentothem/Revslider/Block/Revslider.php(26): Magentothem_Revslider_Helper_Data->initCss()
#13 /home/xxxxxx/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Magentothem_Revslider_Block_Revslider->_toHtml()
#14 /home/xxxxxx/public_html/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#15 /home/xxxxxx/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Text_List->_toHtml()
#16 /home/xxxxxx/public_html/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()
#17 /home/xxxxxx/public_html/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('ma_banner', true)
#18 /home/xxxxxx/public_html/app/design/frontend/ma_optician/ma_optician4/template/page/2columns-right.phtml(47): Mage_Core_Block_Abstract->getChildHtml('ma_banner')
#19 /home/xxxxxx/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/xxxxxx/...')
#20 /home/xxxxxx/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/ma_opt...')
#21 /home/xxxxxx/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#22 /home/xxxxxx/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
#23 /home/xxxxxx/public_html/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#24 /home/xxxxxx/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#25 /home/xxxxxx/public_html/app/code/core/Mage/Cms/Helper/Page.php(137): Mage_Core_Controller_Varien_Action->renderLayout()
#26 /home/xxxxxx/public_html/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'ma_optician4_ho...')
#27 /home/xxxxxx/public_html/app/code/core/Mage/Cms/controllers/IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'ma_optician4_ho...')
#28 /home/xxxxxx/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Cms_IndexController->indexAction()
#29 /home/xxxxxx/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#30 /home/xxxxxx/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#31 /home/xxxxxx/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#32 /home/xxxxxx/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#33 /home/xxxxxx/public_html/index.php(87): Mage::run('', 'store')
#34 {main}
I did this but it didn't resolve the issue.
Navigate to the "errors" folder.
Change local.xml.sample to local.xml
You should now see a new list of crazy errors all over the Magento page - this is okay.
Open magento/lib/Zend/Cache/Backend/File.php and look for:
protected $_options = array(
'cache_dir' => 'null',
Change it to:
protected $_options = array(
'cache_dir' => 'tmp/',
Save it.
Now the final step is to go create a tmp folder in the root Magento folder.
Any more pointers on what's wrong here?
Thank you.
You have any remaned localxxx.xml if it is there, just delete and clear your cache

Large list of search filter errors encountered

I'm having an issue with the search filter, for some reason when I select the filters, I get a page with error codes all over:
There has been an error processing your request
You cannot define a correlation name color_idx more than once
Trace:
#0 /home/oembarga/public_html/lib/Varien/Db/Select.php(281): Zend_Db_Select->_join('inner join', Array, 'color_idx.entit...',
Array, NULL)
#1 /home/oembarga/public_html/lib/Zend/Db/Select.php(336): Varien_Db_Select->_join('inner join', Array, 'color_idx.entit...',
Array, NULL)
#2 /home/oembarga/public_html/lib/Zend/Db/Select.php(315): Zend_Db_Select->joinInner(Array, 'color_idx.entit...', Array, NULL)
#3 /home/oembarga/public_html/app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Attribute.php(70):
Zend_Db_Select->join(Array, 'color_idx.entit...', Array)
#4 /home/oembarga/public_html/app/code/core/Mage/Catalog/Model/Layer/Filter/Attribute.php(94): Mage_Catalog_Model_Resource_Layer_Filter_Attribute->applyFilterToCollection(Object(Mage_Catalog_Model_Layer_Filter_Attribute),
'56')
#5 /home/oembarga/public_html/app/code/core/Mage/Catalog/Block/Layer/Filter/Abstract.php(91):
Mage_Catalog_Model_Layer_Filter_Attribute->apply(Object(Mage_Core_Controller_Request_Http),
Object(Mage_Catalog_Block_Layer_Filter_Attribute))
#6 /home/oembarga/public_html/app/code/core/Mage/Catalog/Block/Layer/Filter/Abstract.php(73):
Mage_Catalog_Block_Layer_Filter_Abstract->_initFilter()
#7 /home/oembarga/public_html/app/code/core/Mage/Catalog/Block/Layer/View.php(136):
Mage_Catalog_Block_Layer_Filter_Abstract->init()
#8 /home/oembarga/public_html/app/code/core/Mage/Core/Block/Abstract.php(293):
Mage_Catalog_Block_Layer_View->_prepareLayout()
#9 /home/oembarga/public_html/app/code/core/Mage/Core/Model/Layout.php(456):
Mage_Core_Block_Abstract->setLayout(Object(Codnitive_Extifcon_Model_Core_Layout))
#10 /home/oembarga/public_html/app/code/core/Mage/Core/Model/Layout.php(472):
Mage_Core_Model_Layout->createBlock('catalog/layer_v...',
'catalog.leftnav')
#11 /home/oembarga/public_html/app/code/core/Mage/Core/Model/Layout.php(239):
Mage_Core_Model_Layout->addBlock('catalog/layer_v...',
'catalog.leftnav')
#12 /home/oembarga/public_html/app/code/core/Mage/Core/Model/Layout.php(205):
Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element),
Object(Mage_Core_Model_Layout_Element))
#13 /home/oembarga/public_html/app/code/core/Mage/Core/Model/Layout.php(210):
Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#14 /home/oembarga/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(344):
Mage_Core_Model_Layout->generateBlocks()
#15 /home/oembarga/public_html/app/code/core/Mage/Cms/Helper/Page.php(113):
Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#16 /home/oembarga/public_html/app/code/core/Mage/Cms/Helper/Page.php(52):
Mage_Cms_Helper_Page->_renderPage(Object(Unirgy_DropshipMicrositePro_IndexController),
'default-microsi...')
#17 /home/oembarga/public_html/app/code/community/Unirgy/DropshipMicrositePro/controllers/IndexController.php(33):
Mage_Cms_Helper_Page->renderPage(Object(Unirgy_DropshipMicrositePro_IndexController), 'default-microsi...')
#18 /home/oembarga/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418):
Unirgy_DropshipMicrositePro_IndexController->landingPageAction()
#19 /home/oembarga/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250):
Mage_Core_Controller_Varien_Action->dispatch('landingPage')
#20 /home/oembarga/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172):
Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#21 /home/oembarga/public_html/app/code/core/Mage/Core/Model/App.php(354):
Mage_Core_Controller_Varien_Front->dispatch()
#22 /home/oembarga/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#23 /home/oembarga/public_html/index.php(88): Mage::run('', 'store')
#24 {main}

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away - What to do?

Here is what I get and I don't know what to do....
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}
write your zend query in a try block
and
catch the exception
Zend_Db_Statement_Mysqli_Exception (check which one you are using 'mysql' or 'mysqli' or 'PDO') in the exception catch code just call {model}->getDefaultAdapter()->closeConnection() and then again call the zend query you have got.
this should solve your problem.
NOTE: Below code is just for reference and should not be used as it is (may have error in it).
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));
}
}