Php yii2 cron给出的错误为;“未找到PDO”;
我在yii2中运行的应用程序很好。我创建了一个命令控制器/commands/TestControllerPhp yii2 cron给出的错误为;“未找到PDO”;,php,mysql,pdo,cron,yii2,Php,Mysql,Pdo,Cron,Yii2,我在yii2中运行的应用程序很好。我创建了一个命令控制器/commands/TestController <?php namespace app\commands; use app\models\UserProfile; use yii\console\Controller; use app\controllers\AppController; /** * Test controller */ class TestController extends Controller {
<?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 as $item){
$birthdayMessage = "Happy Birthday " . $item['user']['username'];
//to send sms
$this->_send_cron_sms($item['mobile'], $birthdayMessage);
}
}
我还尝试了查询生成器,但它也没有帮到我。我通过在php.ini文件中添加这两个扩展名解决了这个问题
extension=pdo.dll
extension=pdo_mysql.dll
我已经问过同样的问题了
extension=pdo.dll
extension=pdo_mysql.dll