当DLO未加载时,Magento Cron作业失败

I am trying to run the Magento Cron job but get this error message. I checked phpinfo() which shows everything should be loaded and the get_loaded_extensions() shows => PDO [27] => pdo_mysql [28] => pdo_sqlite [29]

Any thoughts what I can do next to find the cause?

Thanks, Chris

PHP Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with
message 'The PDO extension is required for this adapter but the extension is
not loaded' in /home/k117235a/domains/greenman-chris.eu/private_html/lib/Zend/Db/Adapter/Pdo/Abstract.php:342
Stack trace: 
#0 /home/k117235a/domains/greenman-chris.eu/private_html/lib/Zend/Db/Adapter/Abstract.php(248): 
Zend_Db_Adapter_Pdo_Abstract->setFetchMode(2) 
#1 /home/k117235a/domains/greenman-chris.eu/private_html/app/code/core/Mage/Core/Model/Resource.php(175): 
Zend_Db_Adapter_Abstract->__construct(Array)
#2 /home/k117235a/domains/greenman-chris.eu/private_html/app/code/core/Mage/Core/Model/Resource.php(110): 
Mage_Core_Model_Resource->_newConnection('pdo_mysql', Object(Mage_Core_Model_Config_Element))
#3 /home/k117235a/domains/greenman-chris.eu/private_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(320): 
Mage_Core_Model_Resource->getConnection('core_write')
#4 /home/k117235a/domains/greenman-chris.eu/private_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract 
in /home/k117235a/domains/greenman-chris.eu/private_html/lib/Zend/Db/Adapter/Pdo/Abstract.php 
on line 342

Probably you are checking the phpinfo() from the browser, but the extension might be loaded just for apache/nginx, and not for commandline, which is how I'm assuming the cronjob php file will run.

Check that the extension is enabled for CLI, typically in the following location:

/etc/php5/cli/conf.d/20-pdo_mysql.ini (the name might not be exactly the same)

It might be only on /etc/php5/apache2/ or /etc/php5/php-fpm/

You can just copy it from the other locations or create a new file with the following content:

extension=pdo_mysql.so

After that check that the extension is loaded by running from command-line:

php -i | grep pdo

If it's loaded you should see some output and the cronjob should now work.

I hope it helps.

Use "$ which php" to ensure you're using the PHP you think you are.
Look at the php.ini your command line PHP is using and see if any extensions are disabled

An alternate method is to have Apache run the cron jobs by using wget:

[specified time] wget -q http://magento.url.com/cron.php

Using this method also helps in cases where file permissions are an issue (specially when Magento's cache is involved).