PHP5.4 连接 SQL SERVER 2008
PHP链接sqlserver需要先安装驱动,不是先把dll放到ext下面,一重启服务器就完事了。
本地环境:
XAMPP 1.8.2
PHP 5.4.31
SQL SERVER 2008 R2
使用的DLL
php_sqlsrv_54_ts.dll
php_pdo_sqlsrv_54_ts.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 ) )
也就是说机器上需要安装驱动。
根据这个帖子地址 的介绍 报错信息有误,应该下载x64。
到这个 地址
点开Install Instructions
下载 Microsoft® SQL Server® 2012 Native Client
下载这个4M多的sqlncli.msi。
官方论坛地址:https://social.technet.microsoft.com/Forums/sqlserver/en-US/home?forum=sqldriverforphp&sort=relevancedesc&brandIgnore=True&searchTerm=php5.4+sql+server+2008