Laravel Multi-Tenancy - Installation Error - laravel

I am trying to pull spatie/laravel-multitenancy into my Laravel application
Installing on Laravel 7 running PHP 7.4
php artisan --version
# Laravel Framework 7.30.4
php -v
# PHP 7.4.13 (cli)
The installation
composer update
composer require "spatie/laravel-multitenancy:^1.0"
Throws up this error at the end
In QueueManager.php line 156:
Trying to access array offset on value of type null
Error Log
[2021-09-01 11:54:41] production.ERROR: Trying to access array offset on value of type null {"exception":"[object] (ErrorException(code: 0): Trying to access array offset on value of type null at D:\\application\\vendor\\laravel\\framework\\src\\Illuminate\\Queue\\QueueManager.php:156)
[stacktrace]
#0 D:\\application\\vendor\\laravel\\framework\\src\\Illuminate\\Queue\\QueueManager.php(156): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(8, 'Trying to acces...', 'D:\\application...', 156, Array)
#1 D:\\application\\vendor\\laravel\\framework\\src\\Illuminate\\Queue\\QueueManager.php(138): Illuminate\\Queue\\QueueManager->resolve('file')
#2 D:\\application\\vendor\\laravel\\framework\\src\\Illuminate\\Queue\\QueueManager.php(258): Illuminate\\Queue\\QueueManager->connection()
#3 D:\\application\\vendor\\spatie\\laravel-multitenancy\\src\\Actions\\MakeQueueTenantAwareAction.php(34): Illuminate\\Queue\\QueueManager->__call('createPayloadUs...', Array)
#4 D:\\application\\vendor\\spatie\\laravel-multitenancy\\src\\Actions\\MakeQueueTenantAwareAction.php(18): Spatie\\Multitenancy\\Actions\\MakeQueueTenantAwareAction->listenForJobsBeingQueued()
#5 D:\\application\\vendor\\spatie\\laravel-multitenancy\\src\\MultitenancyServiceProvider.php(72): Spatie\\Multitenancy\\Actions\\MakeQueueTenantAwareAction->execute()
#6 D:\\application\\vendor\\spatie\\laravel-multitenancy\\src\\MultitenancyServiceProvider.php(33): Spatie\\Multitenancy\\MultitenancyServiceProvider->configureQueue()
#7 [internal function]: Spatie\\Multitenancy\\MultitenancyServiceProvider->boot()
#8 D:\\application\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(37): call_user_func_array(Array, Array)
#9 D:\\application\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Util.php(37): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#10 D:\\application\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(95): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#11 D:\\application\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(39): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#12 D:\\application\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(596): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#13 D:\\application\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(867): Illuminate\\Container\\Container->call(Array)
#14 D:\\application\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(850): Illuminate\\Foundation\\Application->bootProvider(Object(Spatie\\Multitenancy\\MultitenancyServiceProvider))
#15 [internal function]: Illuminate\\Foundation\\Application->Illuminate\\Foundation\\{closure}(Object(Spatie\\Multitenancy\\MultitenancyServiceProvider), 23)
#16 D:\\application\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(851): array_walk(Array, Object(Closure))
#17 D:\\application\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Bootstrap\\BootProviders.php(17): Illuminate\\Foundation\\Application->boot()
#18 D:\\application\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(230): Illuminate\\Foundation\\Bootstrap\\BootProviders->bootstrap(Object(Illuminate\\Foundation\\Application))
#19 D:\\application\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(310): Illuminate\\Foundation\\Application->bootstrapWith(Array)
#20 D:\\application\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(127): Illuminate\\Foundation\\Console\\Kernel->bootstrap()
#21 D:\\application\\artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#22 {main}
"}
Any ideas why this is happening?

Related

Laravel: using count in the where clause throwing error

I am working on a Laravel project. I am trying to write an Eloquent where I need to use raw where clause for COUNT.
This is my query.
$eligibleReceivers = ReceiverDevice::havingRaw('COUNT(phone_number) < 10')
->having('phone_number', '!=', $device->phone_number)
->groupBy('phone_number')->get();
I am trying to select the records where records the same phone_number must be less than 10.
When I run the code, I am getting the following error.
[previous exception] [object] (PDOException(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1055 'fork.receiver_devices.id' isn't in GROUP BY at /var/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:331)
[stacktrace]
#0 /var/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(331): PDO->prepare('select * from `...')
#1 /var/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(662): Illuminate\\Database\\Connection->Illuminate\\Database\\{closure}('select * from `...', Array)
#2 /var/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(629): Illuminate\\Database\\Connection->runQueryCallback('select * from `...', Array, Object(Closure))
#3 /var/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(338): Illuminate\\Database\\Connection->run('select * from `...', Array, Object(Closure))
#4 /var/www/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2149): Illuminate\\Database\\Connection->select('select * from `...', Array, true)
#5 /var/www/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2137): Illuminate\\Database\\Query\\Builder->runSelect()
#6 /var/www/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2609): Illuminate\\Database\\Query\\Builder->Illuminate\\Database\\Query\\{closure}()
#7 /var/www/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2138): Illuminate\\Database\\Query\\Builder->onceWithColumns(Array, Object(Closure))
#8 /var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(545): Illuminate\\Database\\Query\\Builder->get(Array)
#9 /var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(529): Illuminate\\Database\\Eloquent\\Builder->getModels(Array)
#10 /var/www/app/Http/Requests/RegisterDeviceRequest.php(72): Illuminate\\Database\\Eloquent\\Builder->get()
#11 /var/www/app/Http/Requests/RegisterDeviceRequest.php(60): App\\Http\\Requests\\RegisterDeviceRequest->registerReceiversFor(Object(App\\Models\\ClientDevice))
#12 /var/www/app/Http/Controllers/Auth/RegisterDeviceController.php(14): App\\Http\\Requests\\RegisterDeviceRequest->persist()
#13 [internal function]: App\\Http\\Controllers\\Auth\\RegisterDeviceController->store(Object(App\\Http\\Requests\\RegisterDeviceRequest))
#14 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)
#15 /var/www/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\\Routing\\Controller->callAction('store', Array)
#16 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Route.php(219): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(App\\Http\\Controllers\\Auth\\RegisterDeviceController), 'store')
#17 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Route.php(176): Illuminate\\Routing\\Route->runController()
#18 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php(681): Illuminate\\Routing\\Route->run()
What is wrong with my code and how can I fix it?
try to do this :-
In config\database.php in mysql array
Set 'strict' => false // to disable all.

GuzzleHttp not working inside Laravel Listener

I'm trying to shorten certain URL's using tiny URL API because I'm trying to limit the number of characters sent in an SMS. Usually, I do this:
$sms_url = file_get_contents('http://tinyurl . com/api-create.php?url=http://127.0.0.1:8000/billing/export/view/1/0');
It's not working inside my Listener so I did a test in controller and it worked. I changed it to use GuzzleHttp inside my Listener:
$sms_url = Http::get('http://tinyurl . com/api-create.php?url=http://127.0.0.1:8000/billing/export/view/'.$fixed_data->account_number_id.'/'.$fixed_data->subaccount_number_id);
And I have called the following above my Listener file:
use Illuminate\Support\Facades\Http;
I run my code and it's not working. No error. Just blank. What could be my issue?
UPDATE:
The error in my log file:
[2020-08-09 17:02:32] local.ERROR: SQLSTATE[HY000]: General error: 1364 Field 'sms_url' doesn't have a default value (SQL: insert into `pdf` (`account_number_id`, `created_at`, `created_by`, `name`, `path`, `subaccount_number_id`, `updated_by`) values (4, 2020-08-09 17:02:32, 1229, MDAwNDAyMDIwMDgwOUFWdXQ3, storage/uploads/pdf/MDAwNDAyMDIwMDgwOUFWdXQ3.pdf, 0, 1229)) {"exception":"[object] (Illuminate\\Database\\QueryException(code: HY000): SQLSTATE[HY000]: General error: 1364 Field 'sms_url' doesn't have a default value (SQL: insert into `pdf` (`account_number_id`, `created_at`, `created_by`, `name`, `path`, `subaccount_number_id`, `updated_by`) values (4, 2020-08-09 17:02:32, 1229, MDAwNDAyMDIwMDgwOUFWdXQ3, storage/uploads/pdf/MDAwNDAyMDIwMDgwOUFWdXQ3.pdf, 0, 1229)) at /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Database/Connection.php:671)
[stacktrace]
#0 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Database/Connection.php(631): Illuminate\\Database\\Connection->runQueryCallback('insert into `pd...', Array, Object(Closure))
#1 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Database/Connection.php(465): Illuminate\\Database\\Connection->run('insert into `pd...', Array, Object(Closure))
#2 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Database/Connection.php(417): Illuminate\\Database\\Connection->statement('insert into `pd...', Array)
#3 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2785): Illuminate\\Database\\Connection->insert('insert into `pd...', Array)
#4 /Applications/Work/celeb/app/Listeners/ExportAllListener.php(112): Illuminate\\Database\\Query\\Builder->insert(Array)
#5 [internal function]: App\\Listeners\\ExportAllListener->handle(Object(App\\Events\\ExportAllEvent))
#6 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Events/CallQueuedListener.php(93): call_user_func_array(Array, Array)
#7 [internal function]: Illuminate\\Events\\CallQueuedListener->handle(Object(Illuminate\\Foundation\\Application))
#8 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): call_user_func_array(Array, Array)
#9 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Container/Util.php(37): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#10 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(95): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#11 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(39): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#12 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Container/Container.php(596): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#13 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(94): Illuminate\\Container\\Container->call(Array)
#14 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}(Object(Illuminate\\Events\\CallQueuedListener))
#15 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Events\\CallQueuedListener))
#16 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(98): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#17 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(83): Illuminate\\Bus\\Dispatcher->dispatchNow(Object(Illuminate\\Events\\CallQueuedListener), false)
#18 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Queue\\CallQueuedHandler->Illuminate\\Queue\\{closure}(Object(Illuminate\\Events\\CallQueuedListener))
#19 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Events\\CallQueuedListener))
#20 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(85): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#21 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(59): Illuminate\\Queue\\CallQueuedHandler->dispatchThroughMiddleware(Object(Illuminate\\Queue\\Jobs\\DatabaseJob), Object(Illuminate\\Events\\CallQueuedListener))
#22 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\\Queue\\CallQueuedHandler->call(Object(Illuminate\\Queue\\Jobs\\DatabaseJob), Array)
#23 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(356): Illuminate\\Queue\\Jobs\\Job->fire()
#24 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(306): Illuminate\\Queue\\Worker->process('database', Object(Illuminate\\Queue\\Jobs\\DatabaseJob), Object(Illuminate\\Queue\\WorkerOptions))
#25 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(132): Illuminate\\Queue\\Worker->runJob(Object(Illuminate\\Queue\\Jobs\\DatabaseJob), 'database', Object(Illuminate\\Queue\\WorkerOptions))
#26 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(112): Illuminate\\Queue\\Worker->daemon('database', 'default', Object(Illuminate\\Queue\\WorkerOptions))
#27 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(96): Illuminate\\Queue\\Console\\WorkCommand->runWorker('database', 'default')
#28 [internal function]: Illuminate\\Queue\\Console\\WorkCommand->handle()
#29 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): call_user_func_array(Array, Array)
#30 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Container/Util.php(37): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#31 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(95): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#32 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(39): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#33 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Container/Container.php(596): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#34 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Console/Command.php(134): Illuminate\\Container\\Container->call(Array)
#35 /Applications/Work/celeb/vendor/symfony/console/Command/Command.php(258): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#36 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#37 /Applications/Work/celeb/vendor/symfony/console/Application.php(911): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#38 /Applications/Work/celeb/vendor/symfony/console/Application.php(264): Symfony\\Component\\Console\\Application->doRunCommand(Object(Illuminate\\Queue\\Console\\WorkCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#39 /Applications/Work/celeb/vendor/symfony/console/Application.php(140): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#40 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#41 /Applications/Work/celeb/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#42 /Applications/Work/celeb/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#43 {main}
Based on my understanding, the error occurs because the $sms_url is blank. There's no specific error for the file_get_contents() and Http::get().
file_get_contents() is working perfectly inside Listener. I dd'd in my live server and saw it working. So is Guzzle. I added Http Facade and used Http::post()

magento checkout page error with exception log

the magento checkout page give an error saying
There was an error processing your order
I am getting this error. It was working fine from six months. I haven't changed anything.
Troubleshoot:
I have changed to Magento default theme.
I have changed the domain
Change checkout method
Still not working.
my exception.log
2017-04-17T17:28:18+00:00 ERR (3):
exception 'Mage_Core_Exception' with message 'Invalid block type: Cmsmart_Onestepcheckout_Block_Links' in /home/zprz/public_html/app/Mage.php:595
Stack trace:
#0 /home/zprz/public_html/app/code/core/Mage/Core/Model/Layout.php(495): Mage::throwException('Invalid block t...')
#1 /home/zprz/public_html/app/code/core/Mage/Core/Model/Layout.php(437): Mage_Core_Model_Layout->_getBlockInstance('onestepcheckout...', Array)
#2 /home/zprz/public_html/app/code/core/Mage/Core/Model/Layout.php(472): Mage_Core_Model_Layout->createBlock('onestepcheckout...', 'checkout_cart_l...')
#3 /home/zprz/public_html/app/code/core/Mage/Core/Model/Layout.php(239): Mage_Core_Model_Layout->addBlock('onestepcheckout...', 'checkout_cart_l...')
#4 /home/zprz/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))
#5 /home/zprz/public_html/app/code/core/Mage/Core/Model/Layout.php(210): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#6 /home/zprz/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#7 /home/zprz/public_html/app/code/core/Mage/Cms/Helper/Page.php(113): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#8 /home/zprz/public_html/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'no-route')
#9 /home/zprz/public_html/app/code/core/Mage/Cms/controllers/IndexController.php(75): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'no-route')
#10 /home/zprz/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Cms_IndexController->noRouteAction()
#11 /home/zprz/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('noRoute')
#12 /home/zprz/public_html/app/code/local/Elegento/Royal/Controller/Standard.php(82): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#13 /home/zprz/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Elegento_Royal_Controller_Standard->match(Object(Mage_Core_Controller_Request_Http))
#14 /home/zprz/public_html/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#15 /home/zprz/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#16 /home/zprz/public_html/index.php(83): Mage::run('', 'store')
#17 {main}
2017-04-17T17:28:18+00:00 ERR (3):
exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`zprz_mag`.`erp_inventory_warehouse_product`, CONSTRAINT `erp_inventory_warehouse_product_ibfk_1` FOREIGN KEY (`warehouse_id`) REFERENCES `erp_inventory_warehouse` (`warehouse_id`) ON DELETE C)' in /home/zprz/public_html/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /home/zprz/public_html/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /home/zprz/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /home/zprz/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /home/zprz/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#4 /home/zprz/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `er...', Array)
#5 /home/zprz/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `er...', Array)
#6 /home/zprz/public_html/lib/Zend/Db/Adapter/Abstract.php(576): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `er...', Array)
#7 /home/zprz/public_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(453): Zend_Db_Adapter_Abstract->insert('erp_inventory_w...', Array)
#8 /home/zprz/public_html/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Core_Model_Resource_Db_Abstract->save(Object(Magestore_Inventory_Model_Warehouseproduct))
#9 /home/zprz/public_html/app/code/local/Magestore/Inventory/Model/Observer.php(1405): Mage_Core_Model_Abstract->save()
#10 /home/zprz/public_html/app/code/core/Mage/Core/Model/App.php(1357): Magestore_Inventory_Model_Observer->salesOrderPlaceAfter(Object(Varien_Event_Observer))
#11 /home/zprz/public_html/app/code/core/Mage/Core/Model/App.php(1336): Mage_Core_Model_App->_callObserverMethod(Object(Magestore_Inventory_Model_Observer), 'salesOrderPlace...', Object(Varien_Event_Observer))
#12 /home/zprz/public_html/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('sales_order_pla...', Array)
#13 /home/zprz/public_html/app/code/core/Mage/Sales/Model/Order.php(1117): Mage::dispatchEvent('sales_order_pla...', Array)
#14 [internal function]: Mage_Sales_Model_Order->place()
#15 /home/zprz/public_html/app/code/core/Mage/Core/Model/Resource/Transaction.php(105): call_user_func(Array)
#16 /home/zprz/public_html/app/code/core/Mage/Core/Model/Resource/Transaction.php(159): Mage_Core_Model_Resource_Transaction->_runCallbacks()
#17 /home/zprz/public_html/app/code/core/Mage/Sales/Model/Service/Quote.php(189): Mage_Core_Model_Resource_Transaction->save()
#18 /home/zprz/public_html/app/code/core/Mage/Sales/Model/Service/Quote.php(249): Mage_Sales_Model_Service_Quote->submitOrder()
#19 /home/zprz/public_html/app/code/core/Mage/Checkout/Model/Type/Onepage.php(812): Mage_Sales_Model_Service_Quote->submitAll()
#20 /home/zprz/public_html/app/code/core/Mage/Checkout/controllers/OnepageController.php(579): Mage_Checkout_Model_Type_Onepage->saveOrder()
#21 /home/zprz/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Checkout_OnepageController->saveOrderAction()
#22 /home/zprz/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('saveOrder')
#23 /home/zprz/public_html/app/code/local/Elegento/Royal/Controller/Standard.php(82): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#24 /home/zprz/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Elegento_Royal_Controller_Standard->match(Object(Mage_Core_Controller_Request_Http))
#25 /home/zprz/public_html/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#26 /home/zprz/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#27 /home/zprz/public_html/index.php(83): Mage::run('', 'store')
#28 {main}
You have problem with the warehouse plugin (most probably magestore inventory). During the insert in the database there is something wrong that happens. Not knowing so much about the module or the environment, I just can tell you that the request tries to create or update a dependent table but does not succeed. The reasons are multiple but most probably the row alread exists.

Customer emails not sending any more in Magento 1.9.3.2 via cronjob

Magento customer e-mails are not sending any more after update. It shows following message in the cron_schedule table. Our hoster is mittwald and they use a special cron.sh which not uses "ps".
exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE (message_id='33')' at line 1' in /html/update_1.9.3/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /html/update_1.9.3/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /html/update_1.9.3/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /html/update_1.9.3/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /html/update_1.9.3/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#4 /html/update_1.9.3/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('UPDATE `v1_core...', Array)
#5 /html/update_1.9.3/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('UPDATE `v1_core...', Array)
#6 /html/update_1.9.3/lib/Zend/Db/Adapter/Abstract.php(635): Varien_Db_Adapter_Pdo_Mysql->query('UPDATE `v1_core...', Array)
#7 /html/update_1.9.3/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(433): Zend_Db_Adapter_Abstract->update('v1_core_email_q...', Array, 'message_id='33'')
#8 /html/update_1.9.3/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_Core_Model_Email_Queue))
#9 /html/update_1.9.3/app/code/core/Mage/Core/Model/Email/Queue.php(246): Mage_Core_Model_Abstract->save()
#10 [internal function]: Mage_Core_Model_Email_Queue->send(Object(Mage_Cron_Model_Schedule))
#11 /html/update_1.9.3/app/code/core/Mage/Cron/Model/Observer.php(326): call_user_func_array(Array, Array)
#12 /html/update_1.9.3/app/code/core/Mage/Cron/Model/Observer.php(72): Mage_Cron_Model_Observer->_processJob(Object(Mage_Cron_Model_Schedule), Object(Mage_Core_Model_Config_Element))
#13 /html/update_1.9.3/app/code/core/Mage/Core/Model/App.php(1358): Mage_Cron_Model_Observer->dispatch(Object(Varien_Event_Observer))
#14 /html/update_1.9.3/app/code/core/Mage/Core/Model/App.php(1337): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Cron_Model_Observer), 'dispatch', Object(Varien_Event_Observer))
#15 /html/update_1.9.3/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('default', Array)
#16 /html/update_1.9.3/cron.php(78): Mage::dispatchEvent('default')
#17 {main}
Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE (message_id='33')' at line 1, query was: UPDATE `v1_core_email_queue` SET WHERE (message_id='33')' in /html/update_1.9.3/lib/Zend/Db/Statement/Pdo.php:235
Stack trace:
#0 /html/update_1.9.3/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /html/update_1.9.3/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /html/update_1.9.3/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /html/update_1.9.3/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('UPDATE `v1_core...', Array)
#4 /html/update_1.9.3/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('UPDATE `v1_core...', Array)
#5 /html/update_1.9.3/lib/Zend/Db/Adapter/Abstract.php(635): Varien_Db_Adapter_Pdo_Mysql->query('UPDATE `v1_core...', Array)
#6 /html/update_1.9.3/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(433): Zend_Db_Adapter_Abstract->update('v1_core_email_q...', Array, 'message_id='33'')
#7 /html/update_1.9.3/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_Core_Model_Email_Queue))
#8 /html/update_1.9.3/app/code/core/Mage/Core/Model/Email/Queue.php(246): Mage_Core_Model_Abstract->save()
#9 [internal function]: Mage_Core_Model_Email_Queue->send(Object(Mage_Cron_Model_Schedule))
#10 /html/update_1.9.3/app/code/core/Mage/Cron/Model/Observer.php(326): call_user_func_array(Array, Array)
#11 /html/update_1.9.3/app/code/core/Mage/Cron/Model/Observer.php(72): Mage_Cron_Model_Observer->_processJob(Object(Mage_Cron_Model_Schedule), Object(Mage_Core_Model_Config_Element))
#12 /html/update_1.9.3/app/code/core/Mage/Core/Model/App.php(1358): Mage_Cron_Model_Observer->dispatch(Object(Varien_Event_Observer))
#13 /html/update_1.9.3/app/code/core/Mage/Core/Model/App.php(1337): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Cron_Model_Observer), 'dispatch', Object(Varien_Event_Observer))
#14 /html/update_1.9.3/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('default', Array)
#15 /html/update_1.9.3/cron.php(78): Mage::dispatchEvent('default')
#16 {main}
There was an error in v1_core_email_queue WHERE (message_id='33').
The order with the id 33 was already deleted. The solution was just to delete the entry with the id 33.

Laravel Can't connect to local MySQL after Reboot?

Since then i've reboot my VPS server I get the Error in my logs message:
[2014-03-14 10:18:04] log.ERROR: exception 'PDOException' with message 'SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)' in /home/cap-store/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:47
Stack trace:
#0 /home/cap-store/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(47): PDO->__construct('mysql:host=loca...', 'root', 'Rincewind', Array)
#1 /home/cap-store/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(20): Illuminate\Database\Connectors\Connector->createConnection('mysql:host=loca...', Array, Array)
#2 /home/cap-store/bootstrap/compiled.php(6611): Illuminate\Database\Connectors\MySqlConnector->connect(Array)
#3 /home/cap-store/bootstrap/compiled.php(6538): Illuminate\Database\Connectors\ConnectionFactory->make(Array, 'mysql')
#4 /home/cap-store/bootstrap/compiled.php(6512): Illuminate\Database\DatabaseManager->makeConnection('mysql')
#5 /home/cap-store/bootstrap/compiled.php(6400): Illuminate\Database\DatabaseManager->connection(NULL)
#6 /home/cap-store/bootstrap/compiled.php(6387): Illuminate\Database\Eloquent\Model::resolveConnection(NULL)
#7 /home/cap-store/bootstrap/compiled.php(6025): Illuminate\Database\Eloquent\Model->getConnection()
#8 /home/cap-store/bootstrap/compiled.php(5998): Illuminate\Database\Eloquent\Model->newBaseQueryBuilder()
#9 /home/cap-store/bootstrap/compiled.php(5612): Illuminate\Database\Eloquent\Model->newQuery()
#10 /home/cap-store/app/controllers/HomeController.php(7): Illuminate\Database\Eloquent\Model::find(1)
#11 [internal function]: HomeController->getIndex()
#12 /home/cap-store/vendor/laravel/framework/src/Illuminate/Routing/Controllers/Controller.php(138): call_user_func_array(Array, Array)
#13 /home/cap-store/vendor/laravel/framework/src/Illuminate/Routing/Controllers/Controller.php(115): Illuminate\Routing\Controllers\Controller->callMethod('getIndex', Array)
#14 /home/cap-store/bootstrap/compiled.php(4927): Illuminate\Routing\Controllers\Controller->callAction(Object(Illuminate\Foundation\Application), Object(Illuminate\Routing\Router), 'getIndex', Array)
#15 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#16 /home/cap-store/bootstrap/compiled.php(8117): call_user_func_array(Object(Closure), Array)
#17 /home/cap-store/bootstrap/compiled.php(8104): Illuminate\Routing\Route->callCallable()
#18 /home/cap-store/bootstrap/compiled.php(4938): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#19 /home/cap-store/bootstrap/compiled.php(533): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#20 /home/cap-store/bootstrap/compiled.php(520): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#21 /home/cap-store.com/index.php(49): Illuminate\Foundation\Application->run()
#22 {main} [] []
Not understand where the fault lies. I have only reboot the server.
This is not an error of Laravel. Check your mysql instance on the VPS to make sure that your mysql service is running.
I think you did not set the mysql service to start automatically with your VPS.

Resources