Laravel MySQL Error ONLY on Scheduled Tasks (via cron) - mysql

I have a task using the Laravel task scheduler than fires perfectly.
It fires to call a public method named Task::checkSpiders().
This hits an API (works fine) then should update local DB accordingly.
If i create a route as so...
Route::get('/test', function () {
$test = Task::checkSpiders();
}
It run's perfectly.
When i run it from CRON however it throws me this error...
#0 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(55): PDO->__construct('mysql:host=loca...', 'forge', '', Array)
#1 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\Database\Connectors\Connector->createConnection('mysql:host=loca...', Array, Array)
#2 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(61): Illuminate\Database\Connectors\MySqlConnector->connect(Array)
#3 [internal function]: Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connectors\{closure}()
#4 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Connection.php(920): call_user_func(Object(Closure))
#5 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Connection.php(788): Illuminate\Database\Connection->getPdo()
#6 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Connection.php(673): Illuminate\Database\Connection->reconnectIfMissingConnection()
#7 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Connection.php(479): Illuminate\Database\Connection->run('update `tasks` ...', Array, Object(Closure))
#8 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Connection.php(422): Illuminate\Database\Connection->affectingStatement('update `tasks` ...', Array)
#9 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2072): Illuminate\Database\Connection->update('update `tasks` ...', Array)
#10 /var/www/laravel/app/Task.php(60): Illuminate\Database\Query\Builder->update(Array)
#11 /var/www/laravel/app/Task.php(85): App\Task::updateTask('a5b829767a6811e...', 'Finished', '2016-09-14 10:4...', '2016-09-14 11:5...')
#12 /var/www/laravel/app/Console/Kernel.php(34): App\Task::checkSpiders()
#13 [internal function]: App\Console\Kernel->App\Console\{closure}()
#14 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php(507): call_user_func_array(Object(Closure), Array)
#15 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php(61): Illuminate\Container\Container->call(Object(Closure), Array)
#16 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php(61): Illuminate\Console\Scheduling\CallbackEvent->run(Object(Reflexions\DockerLaravel\DockerApplication))
#17 [internal function]: Illuminate\Console\Scheduling\ScheduleRunCommand->fire()
#18 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php(507): call_user_func_array(Array, Array)
#19 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Console/Command.php(169): Illuminate\Container\Container->call(Array)
#20 /var/www/laravel/vendor/symfony/console/Command/Command.php(256): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Console/Command.php(155): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/laravel/vendor/symfony/console/Application.php(794): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /var/www/laravel/vendor/symfony/console/Application.php(186): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Console\Scheduling\ScheduleRunCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /var/www/laravel/vendor/symfony/console/Application.php(117): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(107): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 /var/www/laravel/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 {main}
The code to insert to the DB ( I don't think is relevant but i'll add in anyway..)
$tasks = DB::table('tasks')
->where('id', $id)
->whereNull('end')
->update([
'status' => $status,
'start' => $start,
'end' => $end,
]);
Also, just a note I am running this in Docker using Supervisord to manage CRON with Laravel.
Any help much appreciated!

Stupid Mistake;
CRON is running under a different user thus the enviroment variables loading from .env aren't available.
I checked this by logging the ENV variables from a task run in CRON.
Like so...
Log::info(json_encode(get_defined_vars()));
That returned [] an empty array.
I've since hardcoded the variables to the config and all is working perfectly.
Alternatively I could have set the ENV Variables in PHP (Incase they are used elsewhere) using...
<?php
putenv("KEY=value");
?>

Related

yii2 - An Error occurred while handling another error:

I am trying to implement Metronic Theme to my Yii-2 advanced application's backend. I followed the instructions on GitHub step by step, however I keep getting a blank page with the following error on it. I am truly stuck.
Here is the error:
An Error occurred while handling another error:
Error: Call to undefined method yii\base\ErrorException::getSeverity() in
C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\base\ErrorHandler.php:287
Stack trace:
#0 C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\base\ErrorHandler.php(107):
yii\base\ErrorHandler->logException(Object(yii\base\ErrorException))
#1 [internal function]: yii\base\ErrorHandler-
>handleException(Object(yii\base\ErrorException))
#2 {main}
Previous exception:
yii\base\ErrorException: Illegal string offset 'id' in
C:\xampp\htdocs\advanced\vendor\dlds\yii2-metronic\widgets\NavBar.php:59
Stack trace:
#0 C:\xampp\htdocs\advanced\vendor\dlds\yii2-
metronic\widgets\NavBar.php(59): yii\base\ErrorHandler->handleError(2,
'Illegal string ...', 'C:\\xampp\\htdocs...', 59, Array)
#1 C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\base\Object.php(107):
dlds\metronic\widgets\NavBar->init()
#2 [internal function]: yii\base\Object->__construct(Array)
#3 C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\di\Container.php(381):
ReflectionClass->newInstanceArgs(Array)
#4 C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\di\Container.php(156):
yii\di\Container->build('dlds\\metronic\\w...', Array, Array)
#5 C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\BaseYii.php(348):
yii\di\Container->get('dlds\\metronic\\w...', Array, Array)
#6 C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\base\Widget.php(89):
yii\BaseYii::createObject(Array)
#7 C:\xampp\htdocs\advanced\backend\views\layouts\main.php(47):
yii\base\Widget::begin(Array)
#8 C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\base\View.php(330):
require('C:\\xampp\\htdocs...')
#9 C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\base\View.php(250):
yii\base\View->renderPhpFile('C:\\xampp\\htdocs...', Array)
#10 C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\base\Controller.php(396):
yii\base\View->renderFile('C:\\xampp\\htdocs...', Array,
Object(dektrium\user\controllers\SecurityController))
#11 C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\base\Controller.php(382):
yii\base\Controller->renderContent('\n\n <div clas...')
#12 C:\xampp\htdocs\advanced\vendor\dektrium\yii2-
user\controllers\SecurityController.php(166): yii\base\Controller-
>render('login', Array)
#13 [internal function]: dektrium\user\controllers\SecurityController-
>actionLogin()
#14 C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\base\InlineAction.php(57):
call_user_func_array(Array, Array)
#15 C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\base\Controller.php(156):
yii\base\InlineAction->runWithParams(Array)
#16 C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\base\Module.php(523):
yii\base\Controller->runAction('login', Array)
#17 C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\web\Application.php(102):
yii\base\Module->runAction('user/security/l...', Array)
#18 C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\base\Application.php(380):
yii\web\Application->handleRequest(Object(yii\web\Request))
#19 C:\xampp\htdocs\advanced\admin\index.php(15): yii\base\Application-
>run()
#20 {main}
You must add 'error' on actions
'rules' => [
[
'actions' => ['error', ...

BIGINT UNSIGNED value is out of range for very small (4char) value

While running a pretty average operation, my application crashed with the error message:
[error] [exception.RedBean_Exception_SQL] [22003] - SQLSTATE[22003]: Numeric value out of range: 1690 BIGINT UNSIGNED value is out of range in '(`zurmo`.`account_read`.`count` - 1)'
This error is perplexing me because it's similar to the error message from this question, but for a MUCH smaller value / character count. Even more perplexing is the fact that I KNOW that there are larger regular int values in the database.
Now, I can go into further detail about the application, but this doesn't appear to be an issue with the application or even the database interface (redbean), even though they're both tagged here.
For futher information, here is the stack trace:
REQUEST_URI=/app/index.php/zurmo/role/details?id=4
HTTP_REFERER=https://************/app/index.php/zurmo/role/details?id=4
---
2017/08/30 07:27:57 [warning] [application] Exception class: RedBean_Exception_SQL
#0 /var/www/html/redbean/rb.php(777): RedBean_Driver_PDO->runQuery('update account_...', Array)
#1 /var/www/html/redbean/rb.php(1779): RedBean_Driver_PDO->Execute('update account_...', Array)
#2 /var/www/html/redbean/rb.php(7534): RedBean_Adapter_DBAdapter->exec('update account_...', Array)
#3 /var/www/html/redbean/rb.php(7440): RedBean_Facade::query('exec', 'update account_...', Array)
#4 /var/www/html/app/protected/modules/zurmo/utils/ReadPermissionsOptimizationUtil.php(962): RedBean_Facade::exec('update account_...')
#5 /var/www/html/app/protected/modules/zurmo/utils/ReadPermissionsOptimizationUtil.php(1022): ReadPermissionsOptimizationUtil::decrementCount('account_read', 19716, Object(Role))
#6 /var/www/html/app/protected/modules/zurmo/utils/ReadPermissionsOptimizationUtil.php(1053): ReadPermissionsOptimizationUtil::decrementParentRolesCounts('account_read', 19716, Object(Role))
#7 /var/www/html/app/protected/modules/zurmo/utils/ReadPermissionsOptimizationUtil.php(668): ReadPermissionsOptimizationUtil::bulkDecrementParentRolesCounts('account_read', Array, Object(Role))
#8 /var/www/html/app/protected/modules/zurmo/utils/ReadPermissionsOptimizationUtil.php(604): ReadPermissionsOptimizationUtil::roleParentSetOrRemoved(false, Object(Role))
#9 /var/www/html/app/protected/modules/zurmo/utils/AllPermissionsOptimizationUtil.php(357): ReadPermissionsOptimizationUtil::roleParentBeingRemoved(Object(Role))
#10 /var/www/html/app/protected/modules/zurmo/models/Role.php(181): AllPermissionsOptimizationUtil::roleParentBeingRemoved(Object(Role))
#11 /var/www/html/app/protected/core/models/RedBeanModel.php(1909): Role->beforeSave()
#12 /var/www/html/app/protected/modules/zurmo/models/Item.php(123): RedBeanModel->save(false, NULL)
#13 /var/www/html/app/protected/modules/zurmo/utils/ZurmoControllerUtil.php(162): Item->save(false)
#14 /var/www/html/app/protected/modules/zurmo/utils/ZurmoControllerUtil.php(109): ZurmoControllerUtil->saveModelFromSanitizedData(Array, Object(Role), false, 'Philippines Des...', false)
#15 /var/www/html/app/protected/modules/zurmo/components/ZurmoBaseController.php(738): ZurmoControllerUtil->saveModelFromPost(Array, Object(Role), false, 'Philippines Des...', false)
#16 /var/www/html/app/protected/modules/zurmo/controllers/RoleController.php(99): ZurmoBaseController->attemptToSaveModelFromPost(Object(Role))
#17 /var/www/html/app/protected/modules/zurmo/controllers/RoleController.php(74): ZurmoRoleController->actionEdit('4')
#18 [internal function]: ZurmoRoleController->actionDetails('4')
#19 /var/www/html/yii/framework/web/actions/CAction.php(109): ReflectionMethod->invokeArgs(Object(ZurmoRoleController), Array)
#20 /var/www/html/yii/framework/web/actions/CInlineAction.php(47): CAction->runWithParamsInternal(Object(ZurmoRoleController), Object(ReflectionMethod), Array)
#21 /var/www/html/yii/framework/web/CController.php(308): CInlineAction->runWithParams(Array)
#22 /var/www/html/yii/framework/web/filters/CFilterChain.php(133): CController->runAction(Object(CInlineAction))
#23 /var/www/html/yii/framework/web/filters/CFilter.php(40): CFilterChain->run()
#24 /var/www/html/yii/framework/web/filters/CFilterChain.php(130): CFilter->filter(Object(CFilterChain))
#25 /var/www/html/yii/framework/web/CController.php(291): CFilterChain->run()
#26 /var/www/html/yii/framework/web/CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array)
#27 /var/www/html/yii/framework/web/CWebApplication.php(286): CController->run('details')
#28 /var/www/html/yii/framework/web/CWebApplication.php(141): CWebApplication->runController('zurmo/role/deta...')
#29 /var/www/html/yii/framework/base/CApplication.php(185): CWebApplication->processRequest()
#30 /var/www/html/app/protected/core/components/WebApplication.php(88): CApplication->run()
#31 /var/www/html/app/index.php(75): WebApplication->run()
#32 {main}
What can be done to resolve this? I feel like it's somehow related to the database's configuration, but I don't know what to look at for it.
count may be a 'reserved' element.
SHOW CREATE TABLE table_name may have some details about the data types that are critical.
Search in SO for SQLSTATE 22003 and you will find many previous experiences and many with resolutions that resolved the error message.

CakePHP and Phinx addForeignKey fails, duplicate column

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?

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

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));
}
}