YiiFramework ServerPilot CDbConnection找不到扩展


YiiFramework ServerPilot CDbConnection could not find extension

我刚刚在serverpilot.io上安装了一个Yii Framework web应用程序,但无法连接到数据库。如果我尝试使用mysql_connect或PDO直接连接,它不会出错。

$mysqlConnection = new PDO("mysql:host=localhost;dbname=xxx", "yyy", "zzz");

这些是我的PDO驱动程序:dblib、mysql、odbc、pgsql、sqlite。这是我的pdo_mysql版本:mysqlnd 5.0.12-dev-20150407-$Id:f59eb767fe17a679589b5c076d9fa88d3d4eac0$

根据我在phpinfo中看到的,pdo_mysql已经安装好了,有什么我遗漏的吗?非常感谢。

[编辑]

这是我的配置:

array(
    'connectionString' => 'mysql:host=localhost;dbname=xxx',
    'emulatePrepare' => false,
    'username' => 'yyy', 
    'password' => 'zzz',
    'charset' => 'utf8',
    'class'=>'application.extensions.PHPPDO.CPdoDbConnection',
    'pdoClass' => 'PHPPDO',
    'enableProfiling' => true,
    'enableParamLogging' => true
)

找到原因。我只知道mysql_connect在PHP7中是不推荐使用的。默认情况下,serverpilot中的PHP版本是PHP7,我使用的是PHPPDO扩展,它使用的是mysql扩展,而不是mysqli。这就是为什么如果我尝试手动连接,它不会抛出错误,但每次我尝试使用Yii连接时都会抛出错误。希望这能帮助那些可能面临同样问题的人。