Windows IIS - PHP PDO Mysql 找不到驱动程序

Windows IIS - PHP PDO Mysql Could not find driver

我有以下代码从本地 PHP(Windows,使用 IIS)连接到 Mysql 数据库,

$dbhost     = "xxxx.database.windows.net";
$dbname     = "yyyy";
$dbuser     = "uuuu";
$dbpass     = "pppp";
$driver     = "sqlsrv";
$connection = new PDO("$driver:host=$dbhost;dbname=$dbname",$dbuser,$dbpass);

php 信息是这样说的:

Loaded Configuration File   C:\Program Files (x86)\IIS Express\PHP\v5.6\php.ini

我在这个 php.ini 文件中有以下内容

[WebPIChanges]
error_log=C:\Windows\temp\PHP56ForIISExpress_errors.log
upload_tmp_dir=C:\Windows\temp
session.save_path=C:\Windows\temp
cgi.force_redirect=0
cgi.fix_pathinfo=1
fastcgi.impersonate=1
fastcgi.logging=0
max_execution_time=300
date.timezone=Europe/Minsk
extension_dir="C:\Program Files (x86)\iis express\PHP\v5.6\ext\"

[ExtensionList]
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_mbstring.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_curl.dll
extension=php_exif.dll
extension=php_xmlrpc.dll
extension=php_openssl.dll
extension=php_soap.dll
extension=php_pdo_mysql.dll
extension=php_pdo_sqlite.dll
extension=php_imap.dll
extension=php_tidy.dll
extension=php_sqlsrv.dll

此文件存在:C:\Program Files (x86)\IIS Express\PHP\v5.6\ext\php_pdo_mysql.dll

为什么我会收到 "could not find driver" 错误?我的应用程序池可以 运行 32 位或 64 位。

有两件事是错误的。我有错误的连接字符串。应该是

$connection = new PDO("$driver:Server=$dbhost;Database=$dbname",$dbuser,$dbpass);

我还缺少 sql 服务器的扩展!!!

extension=php_pdo_sqlsrv_56_nts.dll

我的电脑上什至没有 5.6 版,只能从这里下载:

https://www.microsoft.com/en-us/download/confirmation.aspx?id=20098