我在使用PHP中的sqlsrv_connect
在Windows 2003服务器上使用sqlsrv连接mssql server 2008时遇到以下错误。已安装Microsoft SQL Server 2008 Native Client。在IIS 6.0上运行的Web服务器
这是php.ini内容
=======================
[PHP_SQLSRV]
extension=php_sqlsrv_53_ts_vc9.dll
[PHP_PDO_SQLSRV]
extension=php_pdo_sqlsrv_53_nts_vc6.dll
php_pdo_sqlite.dll
=======================
Array
(
[0] => Array
(
[0] => IMSSP
[SQLSTATE] => IMSSP
[1] => -49
[code] => -49
[2] => This extension requires the Microsoft SQL Server 2012 Native Client. Access the following URL to download the Microsoft SQL Server 2012 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712
[message] => This extension requires the Microsoft SQL Server 2012 Native Client. Access the following URL to download the Microsoft SQL Server 2012 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712
)
[1] => Array
(
[0] => IM002
[SQLSTATE] => IM002
[1] => 0
[code] => 0
[2] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
[message] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
)
)
答案 0 :(得分:0)
两种尝试方式,
首先检查Native驱动程序是否具有正确的版本 -
你的服务器真的是32位版本而不是84位吗?
另一件事是,检查扩展是否实际加载。
要检查一下,请创建一个像“phpinfo.php”这样的文件并将其放在.htdocs的文件夹中。
<?php
// show phpinfo file
phpinfo();
?>
简单的方法是使用Ctrl + F和“extension = php_sqlsrv_53_ts_vc9.dll”
在phpinfo-Page中搜索它答案 1 :(得分:0)
(+) Install Instructions
部分,然后点击它。Microsoft® SQL Server® 2012 Native Client
。X86包(sqlncli.msi)X86 direct link
X64 Package(sqlncli.msi)其评论中的直接链接
答案 2 :(得分:0)
确保安装Microsoft SQL Server 2012 Native Client。 关注Can CSS detect the number of children an element has?