简体   繁体   English

将yii2应用程序与sql server连接时出现“找不到驱动程序”错误

[英]“could not find driver” error while connection yii2 application with sql server

I am trying to connect my yii2 basic application with sql server. 我正在尝试将yii2基本应用程序与sql server连接。 But i am getting error 但是我出错了

Database Exception – yii\db\Exception

could not find driver

Here is my connection credentials 这是我的连接凭证

'sqlserver' => [
            'class' => 'yii\db\Connection',
            'dsn' => 'sqlsrv:Server=localhost;dbname=TestDatabase',
            'username' => 'sa',
            'password' => 'test123',
            'schemaMap' => [
                'sqlsrv'=> [
                  'class'=>'yii\db\mssql\Schema',
                  //'defaultSchema' => 'public' //specify your schema here
                ]
            ],
        ],

I found that sql server drivers were missing in xampp so i added These dll files php_sqlsrv_7_nts_x64.dll php_pdo_sqlsrv_7_nts_x64.dll 我发现xampp中缺少sql服务器驱动程序,因此我添加了这些dll文件php_sqlsrv_7_nts_x64.dll php_pdo_sqlsrv_7_nts_x64.dll

and added this code in php.ini extension=php_sqlsrv_7_nts_x64.dll extension=php_pdo_sqlsrv_7_nts_x64.dll 并在php.ini extension=php_sqlsrv_7_nts_x64.dll extension=php_pdo_sqlsrv_7_nts_x64.dll添加了此代码

but still getting same error 但仍然出现相同的错误

What could be the solution? 有什么解决方案?

You have to install the php drivers for the database you want to use. 您必须为要使用的数据库安装php驱动程序。 I supopse its MS SQL, here you have the link . 我支持其MS SQL,在这里您具有链接

I m also getting same error 我也遇到同样的错误

Database Exception – yii\\db\\Exception 数据库异常– yii \\ db \\ Exception

Could not find driver 找不到驱动程序

But I m able connect using simple php code. 但是我可以使用简单的PHP代码进行连接。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Yii 1:连接到Microsoft SQL Server时找不到驱动程序错误 - Yii 1: Could not find driver error when connecting to microsoft sql server 在 yii2 中迁移时出现异常“找不到驱动程序” - Exception 'could not find driver' while migration in yii2 找不到驱动 Yii2 迁移 - Could not find driver Yii2 migration 在 yii2 中找不到驱动程序 PDOException - Could not find driver PDOException in yii2 Yii2 异常 'yii\\db\\Exception' 带有消息“找不到驱动程序” - Yii2 exception 'yii\db\Exception' with message 'could not find driver' Laravel 和 MS SQL Server 数据库连接抛出错误“(3/3) QueryException 找不到驱动程序” - Laravel and MS SQL Server Database connection is throwing the error "(3/3) QueryException could not find driver" CDbConnection无法打开数据库连接:在Yii中使用ORACLE数据库时找不到驱动程序 - CDbConnection failed to open the DB connection: could not find driver while using ORACLE database in Yii Yii CDbConnection无法打开数据库连接:找不到google cloud sql的驱动程序 - Yii CDbConnection failed to open the DB connection: could not find driver with google cloud sql Yii 1.1.x CDbHttpSession错误:CDbConnection无法打开数据库连接:找不到驱动程序 - Yii 1.1.x CDbHttpSession error: CDbConnection failed to open the DB connection: could not find driver PDO 错误:找不到驱动程序(SQL Server 连接) - PDO Error: could not find driver (SQL Server connect)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM