0

I'm currently running a version of Magento 2 (2.2.7) on a hosted server and I've been having trouble with Database connection and Cron Jobs.

These errors have persisted for around a few days now now and happen intermittently on both the front and back-end. Generally taking the form of a white background with the following error:

PDOException: SQLSTATE[HY000] [2002] No such file or directory in /var/www/vhosts/website.com/httpdocs/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php:128 Stack trace: #0 /var/www/vhosts/website.com/httpdocs/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(128): PDO->__construct('mysql:host=loca...', 'username_admin', 'Saj2f7&0', Array) #1 /var/www/vhosts/website.com/httpdocs/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect() #2 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(398): Zend_Db_Adapter_Pdo_Mysql->_connect() #3 /var/www/vhosts/website.com/httpdocs/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(460): Magento\Framework\DB\Adapter\Pdo\Mysql->_connect() #4 /var/www/vhosts/website.com/httpdocs/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `store_w...', Array) #5 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(533): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `store_w...', Array) #6 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(605): Magento\Framework\DB\Adapter\Pdo\Mysql->_query('SELECT `store_w...', Array) #7 /var/www/vhosts/website.com/httpdocs/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(737): Magento\Framework\DB\Adapter\Pdo\Mysql->query(Object(Magento\Framework\DB\Select), Array) #8 /var/www/vhosts/website.com/httpdocs/vendor/magento/module-store/App/Config/Source/RuntimeConfigSource.php(87): Zend_Db_Adapter_Abstract->fetchAll(Object(Magento\Framework\DB\Select)) #9 /var/www/vhosts/website.com/httpdocs/vendor/magento/module-store/App/Config/Source/RuntimeConfigSource.php(57): Magento\Store\App\Config\Source\RuntimeConfigSource->getEntities('store_website', 'code') #10 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/App/Config/ConfigSourceAggregated.php(40): Magento\Store\App\Config\Source\RuntimeConfigSource->get('') #11 /var/www/vhosts/website.com/httpdocs/generated/code/Magento/Framework/App/Config/ConfigSourceAggregated/Proxy.php(95): Magento\Framework\App\Config\ConfigSourceAggregated->get('') #12 /var/www/vhosts/website.com/httpdocs/vendor/magento/module-store/App/Config/Type/Scopes.php(63): Magento\Framework\App\Config\ConfigSourceAggregated\Proxy->get() #13 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/App/Config.php(131): Magento\Store\App\Config\Type\Scopes->get('stores/1') #14 /var/www/vhosts/website.com/httpdocs/generated/code/Magento/Framework/App/Config/Interceptor.php(63): Magento\Framework\App\Config->get('scopes', 'stores/1', Array) #15 /var/www/vhosts/website.com/httpdocs/vendor/magento/module-store/Model/StoreRepository.php(103): Magento\Framework\App\Config\Interceptor->get('scopes', 'stores/1', Array) #16 /var/www/vhosts/website.com/httpdocs/vendor/magento/module-store/Model/StoreRepository.php(122): Magento\Store\Model\StoreRepository->getById('1') #17 /var/www/vhosts/website.com/httpdocs/vendor/magento/module-store/Model/StoreResolver.php(171): Magento\Store\Model\StoreRepository->getActiveStoreById('1') #18 /var/www/vhosts/website.com/httpdocs/vendor/magento/module-store/Model/StoreResolver.php(109): Magento\Store\Model\StoreResolver->getDefaultStoreById('1') #19 /var/www/vhosts/website.com/httpdocs/vendor/magento/module-store/Model/StoreManager.php(157): Magento\Store\Model\StoreResolver->getCurrentStoreId() #20 /var/www/vhosts/website.com/httpdocs/generated/code/Magento/Store/Model/StoreManagerInterface/Proxy.php(119): Magento\Store\Model\StoreManager->getStore(NULL) #21 /var/www/vhosts/website.com/httpdocs/vendor/magento/module-store/Model/Resolver/Store.php(29): Magento\Store\Model\StoreManagerInterface\Proxy->getStore(NULL) #22 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/App/Config/ScopeCodeResolver.php(49): Magento\Store\Model\Resolver\Store->getScope(NULL) #23 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/App/Config.php(69): Magento\Framework\App\Config\ScopeCodeResolver->resolve('stores', NULL) #24 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Config->getValue('dev/debug/debug...', 'stores') #25 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\Config\Interceptor->___callParent('getValue', Array) #26 [internal function]: Magento\Framework\App\Config\Interceptor->Magento\Framework\Interception\{closure}('dev/debug/debug...', 'store') #27 /var/www/vhosts/website.com/httpdocs/app/code/Ess/M2ePro/Plugin/AbstractPlugin.php(34): call_user_func_array(Object(Closure), Array) #28 /var/www/vhosts/website.com/httpdocs/app/code/Ess/M2ePro/Plugin/Order/Magento/Framework/App/Config.php(44): Ess\M2ePro\Plugin\AbstractPlugin->execute('getValue', Object(Magento\Framework\App\Config\Interceptor), Object(Closure), Array) #29 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/Interception/Interceptor.php(135): Ess\M2ePro\Plugin\Order\Magento\Framework\App\Config->aroundGetValue(Object(Magento\Framework\App\Config\Interceptor), Object(Closure), 'dev/debug/debug...', 'store') #30 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\Config\Interceptor->Magento\Framework\Interception\{closure}('dev/debug/debug...', 'store') #31 /var/www/vhosts/website.com/httpdocs/generated/code/Magento/Framework/App/Config/Interceptor.php(26): Magento\Framework\App\Config\Interceptor->___callPlugins('getValue', Array, NULL) #32 /var/www/vhosts/website.com/httpdocs/vendor/magento/module-developer/Model/Logger/Handler/Debug.php(63): Magento\Framework\App\Config\Interceptor->getValue('dev/debug/debug...', 'store') #33 /var/www/vhosts/website.com/httpdocs/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(31): Magento\Developer\Model\Logger\Handler\Debug->isHandling(Array) #34 /var/www/vhosts/website.com/httpdocs/vendor/monolog/monolog/src/Monolog/Logger.php(344): Monolog\Handler\AbstractProcessingHandler->handle(Array) #35 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/Logger/Monolog.php(48): Monolog\Logger->addRecord(400, 'SQLSTATE[HY000]...', Array) #36 /var/www/vhosts/website.com/httpdocs/vendor/monolog/monolog/src/Monolog/Logger.php(707): Magento\Framework\Logger\Monolog->addRecord(400, 'SQLSTATE[HY000]...', Array) #37 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/App/Bootstrap.php(262): Monolog\Logger->error('SQLSTATE[HY000]...') #38 /var/www/vhosts/website.com/httpdocs/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor)) #39 {main} Next Zend_Db_Adapter_Exception: SQLSTATE[HY000] [2002] No such file or directory in /var/www/vhosts/website.com/httpdocs/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php:144 Stack trace: #0 /var/www/vhosts/website.com/httpdocs/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect() #1 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(398): Zend_Db_Adapter_Pdo_Mysql->_connect() #2 /var/www/vhosts/website.com/httpdocs/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(460): Magento\Framework\DB\Adapter\Pdo\Mysql->_connect() #3 /var/www/vhosts/website.com/httpdocs/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `store_w...', Array) #4 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(533): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `store_w...', Array) #5 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(605): Magento\Framework\DB\Adapter\Pdo\Mysql->_query('SELECT `store_w...', Array) #6 /var/www/vhosts/website.com/httpdocs/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(737): Magento\Framework\DB\Adapter\Pdo\Mysql->query(Object(Magento\Framework\DB\Select), Array) #7 /var/www/vhosts/website.com/httpdocs/vendor/magento/module-store/App/Config/Source/RuntimeConfigSource.php(87): Zend_Db_Adapter_Abstract->fetchAll(Object(Magento\Framework\DB\Select)) #8 /var/www/vhosts/website.com/httpdocs/vendor/magento/module-store/App/Config/Source/RuntimeConfigSource.php(57): Magento\Store\App\Config\Source\RuntimeConfigSource->getEntities('store_website', 'code') #9 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/App/Config/ConfigSourceAggregated.php(40): Magento\Store\App\Config\Source\RuntimeConfigSource->get('') #10 /var/www/vhosts/website.com/httpdocs/generated/code/Magento/Framework/App/Config/ConfigSourceAggregated/Proxy.php(95): Magento\Framework\App\Config\ConfigSourceAggregated->get('') #11 /var/www/vhosts/website.com/httpdocs/vendor/magento/module-store/App/Config/Type/Scopes.php(63): Magento\Framework\App\Config\ConfigSourceAggregated\Proxy->get() #12 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/App/Config.php(131): Magento\Store\App\Config\Type\Scopes->get('stores/1') #13 /var/www/vhosts/website.com/httpdocs/generated/code/Magento/Framework/App/Config/Interceptor.php(63): Magento\Framework\App\Config->get('scopes', 'stores/1', Array) #14 /var/www/vhosts/website.com/httpdocs/vendor/magento/module-store/Model/StoreRepository.php(103): Magento\Framework\App\Config\Interceptor->get('scopes', 'stores/1', Array) #15 /var/www/vhosts/website.com/httpdocs/vendor/magento/module-store/Model/StoreRepository.php(122): Magento\Store\Model\StoreRepository->getById('1') #16 /var/www/vhosts/website.com/httpdocs/vendor/magento/module-store/Model/StoreResolver.php(171): Magento\Store\Model\StoreRepository->getActiveStoreById('1') #17 /var/www/vhosts/website.com/httpdocs/vendor/magento/module-store/Model/StoreResolver.php(109): Magento\Store\Model\StoreResolver->getDefaultStoreById('1') #18 /var/www/vhosts/website.com/httpdocs/vendor/magento/module-store/Model/StoreManager.php(157): Magento\Store\Model\StoreResolver->getCurrentStoreId() #19 /var/www/vhosts/website.com/httpdocs/generated/code/Magento/Store/Model/StoreManagerInterface/Proxy.php(119): Magento\Store\Model\StoreManager->getStore(NULL) #20 /var/www/vhosts/website.com/httpdocs/vendor/magento/module-store/Model/Resolver/Store.php(29): Magento\Store\Model\StoreManagerInterface\Proxy->getStore(NULL) #21 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/App/Config/ScopeCodeResolver.php(49): Magento\Store\Model\Resolver\Store->getScope(NULL) #22 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/App/Config.php(69): Magento\Framework\App\Config\ScopeCodeResolver->resolve('stores', NULL) #23 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Config->getValue('dev/debug/debug...', 'stores') #24 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\Config\Interceptor->___callParent('getValue', Array) #25 [internal function]: Magento\Framework\App\Config\Interceptor->Magento\Framework\Interception\{closure}('dev/debug/debug...', 'store') #26 /var/www/vhosts/website.com/httpdocs/app/code/Ess/M2ePro/Plugin/AbstractPlugin.php(34): call_user_func_array(Object(Closure), Array) #27 /var/www/vhosts/website.com/httpdocs/app/code/Ess/M2ePro/Plugin/Order/Magento/Framework/App/Config.php(44): Ess\M2ePro\Plugin\AbstractPlugin->execute('getValue', Object(Magento\Framework\App\Config\Interceptor), Object(Closure), Array) #28 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/Interception/Interceptor.php(135): Ess\M2ePro\Plugin\Order\Magento\Framework\App\Config->aroundGetValue(Object(Magento\Framework\App\Config\Interceptor), Object(Closure), 'dev/debug/debug...', 'store') #29 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\Config\Interceptor->Magento\Framework\Interception\{closure}('dev/debug/debug...', 'store') #30 /var/www/vhosts/website.com/httpdocs/generated/code/Magento/Framework/App/Config/Interceptor.php(26): Magento\Framework\App\Config\Interceptor->___callPlugins('getValue', Array, NULL) #31 /var/www/vhosts/website.com/httpdocs/vendor/magento/module-developer/Model/Logger/Handler/Debug.php(63): Magento\Framework\App\Config\Interceptor->getValue('dev/debug/debug...', 'store') #32 /var/www/vhosts/website.com/httpdocs/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(31): Magento\Developer\Model\Logger\Handler\Debug->isHandling(Array) #33 /var/www/vhosts/website.com/httpdocs/vendor/monolog/monolog/src/Monolog/Logger.php(344): Monolog\Handler\AbstractProcessingHandler->handle(Array) #34 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/Logger/Monolog.php(48): Monolog\Logger->addRecord(400, 'SQLSTATE[HY000]...', Array) #35 /var/www/vhosts/website.com/httpdocs/vendor/monolog/monolog/src/Monolog/Logger.php(707): Magento\Framework\Logger\Monolog->addRecord(400, 'SQLSTATE[HY000]...', Array) #36 /var/www/vhosts/website.com/httpdocs/vendor/magento/framework/App/Bootstrap.php(262): Monolog\Logger->error('SQLSTATE[HY000]...') #37 /var/www/vhosts/website.com/httpdocs/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor)) #38 {main}

Also my Cron jobs do not seem to be running (most noticably my orders are not updating to "processing" from "Payment review" for a certain payment method)

I've checked in the database cron_schedule and a number of Cron jobs have been set to "running" and don't seem to have come out. So I think this might be causing a problem.

The sites styles load fine and we haven't changed anything on the site just before the problems started so not sure what is causing this.

The solution for the cron jobs is detailed here in developer docs: https://devdocs.magento.com/guides/v2.2/cloud/trouble/reset-cron-jobs.html

The server team have mentioned that I do not seem to have "ece-tools" installed. I've been reading the developer docs here: https://devdocs.magento.com/guides/v2.2/cloud/project/ece-tools-upgrade-project.html

And they keep mentioning "Magento Commerce Cloud", but my Magento version says "Magento/2.2 (Community)" and looking through my composer.lock and composer.json files I cannot find the following deprecated packages they mention:

  • magento/magento-cloud-configuration
  • magento/ece-patches

For this reason I'm not sure if my particular version of Magento 2 actially requires the ece-tools. I'd like to know for sure before I start modifying the composer.lock and composer.json files as I don't want to mess anything up.

If someone could let me know in laymans terms what ece-tools are and if I actually need them for my site or if I can resolve these issues without them I would greatly appreciate it.

1

ECE-Tools is a set of scripts and tools designed to manage and deploy Cloud projects. The Cloud tools package is compatible with Magento version 2.1.4 and later to provide a rich set of features you can use to manage your Magento Commerce project.

Reference Link: https://github.com/magento/ece-tools

I don't think you need ECE Tools as it is for Magento Commerce (Formerly termed as Magento Enterprise) Cloud.

Most of the times the posted error happens when there is a space issue. So, please check the space availability and resolve it.

  • Hi. Thanks for letting me know. I've updated the question to answer your points. The main issue is my cron jobs are not running automatically, I've checked an a number are stuck in the "running" mode and it seems that the solution (detailed here devdocs.magento.com/guides/v2.2/cloud/trouble/…) requires ece tools. – CJNotts Mar 11 at 10:58
  • I encountered the error most of the times when there is not enough space. Please check the space in your server. If this issue is resolved, cron jobs may start running. – Kalyan Chakravarthi V Mar 11 at 12:33
  • Thanks. Have checked and we are indeed having some server issues and space has been a problem. We have contacted our server team and are getting the server upgraded. With regards to the Cron jobs stuck in the "running" status, am I OK to just delete those in the phpmyadmin system or will that cause problems on the system? – CJNotts Mar 11 at 13:23
  • I am assuming that you are talking about cron jobs but not about indexers. You can please remove using PhpMyAdmin. Site is already down and no cron job will resume from the state it stopped. So keeping the will not make any sense. If you are talking about indexers you can please use this command to reset the indexers. php bin/magento indexer:reset – Kalyan Chakravarthi V Mar 11 at 13:53
  • Happy that my answer helped you. I updated my answer, can you please accept it as solution and give me upvote? thanks – Kalyan Chakravarthi V Mar 11 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.