php - yii2 cron giving error of "PDO not found" -
i running application in yii2. created command controller /commands/testcontroller
<?php namespace app\commands; use app\models\userprofile; use yii\console\controller; use app\controllers\appcontroller; /** * test controller */ class testcontroller extends controller { public function actionindex() { echo "cron service running"; } public function actionsendbirthdaysms() { $userprofile = userprofile::find() ->where('month(dob) = month(date(now()))') ->andwhere('day(dob) = day(now()) ') ->with('user') ->asarray() ->all(); foreach($userprofile $item){ $birthdaymessage = "happy birthday " . $item['user']['username']; //to send sms $this->_send_cron_sms($item['mobile'], $birthdaymessage); } } i have 2 functions here. when call php /home/user/public_html/yii test/index gives correct output command line , cron both.
but when running php /home/user/public_html/yii test/send-birthday-sms, runs ok command line in ssh environment , receiving sms. giving error in cron. here received in email:
status: 500 internal server error x-powered-by: php/5.4.39 content-type: text/html php fatal error 'yii\base\errorexception' message 'class 'pdo' not found' in /home/user/public_html/vendor/yiisoft/yii2/db/connection.php:609 stack trace: #0 [internal function]: yii\base\errorhandler->handlefatalerror() #1 {main} i tried query builder did not helped me.
i have solved issue adding these 2 extensions in php.ini file
extension=pdo.dll extension=pdo_mysql.dll i asked same question in yii forum
Comments
Post a Comment