Magento – Cron.sh error: PHP Fatal error: Uncaught exception ‘Zend_Db_Adapter_Exception’ with message ‘pdo_thesql extension is not installed’

crontabmagento-1.9php-5.6php-pdo

The problem occurs in a Magento 1.9.2.4 installation (upgraded from 1.7.2 and then migrated to this new VPS)

Trying to run the cron.sh on a centos VPS (DirectAdmin Controlpanel)

This is returns the following error;

PHP Fatal error:  Uncaught exception 'Zend_Db_Adapter_Exception' with message 'pdo_mysql extension is not installed' in /home/user/domains/domain.com/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php:372
Stack trace:

#0/home/user/domains/domain.com/public_html/lib/Zend/Db/Adapter/Abstract.php(460): Varien_Db_Adapter_Pdo_Mysql->_connect()

#1/home/user/domains/domain.com/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array)

#2/home/user/domains/domain.com/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('SET NAMES utf8', Array)

#3/home/user/domains/domain.com/public_html/app/code/core/Mage/Core/Model/Resource.php(179): Varien_Db_Adapter_Pdo_Mysql->query('SET NAMES utf8')

#4/home/user/domains/domain.com/public_html/app/code/core/Mage/Core/Model/Resource.php(110): Mage_Core_Model_Res in /home/user/domains/domain.com/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php on line 372

(same happens with cron.php)

"php -m" is showing PDO /pdo_mysql /pdo_sqlite

Also the modules are showing the phpinfo file

PDO Drivers enabled are mysql, sqlite

Server is running Php 5.6.11 (php-fpm56) & MySQL 5.5.31

i am a bit at a loss here as the extension is installed and from what I understand it should be available for CLI if it shows in php -m?

Best Answer

Try running

sudo apt-get install php5.6-mysql

You may want to remove any other version first, like php7.0-mysql or php5.5-mysql. Be careful as this will remove configuration files.

sudo apt-get purge php7.0-mysql