windows操作系统下php工具箱如何连接到数据sql server2008R2

1、https://www.microsoft.com/en-us/download/details.aspx?id=20098打开此链接,查看下面的system Requirements内容对比你所使用的php版本与操作系统。

重点关注以下内容

  • Version support for PHP is as follows
    • Version 4.0 supports PHP 7.0+ on Windows and Linux
    • Version 3.2 supports PHP 5.6, 5.5, and 5.4 on Windows
    • Version 3.1 supports PHP 5.5 and 5.4 on Windows
    • Version 3.0 supports PHP 5.4 on Windows
  • Version 4.0 requires Microsoft ODBC Driver 11 or Microsoft ODBC Driver 13. Version 4.0 for Linux requires Microsoft ODBC Driver 13.
  • Versions 3.2 and 3.1 of the driver require Microsoft ODBC Driver 11. You can download the Microsoft ODBC Driver 11 here.
  • Version 3.0 requires the x86 version of Microsoft SQL Server 2012 Native Client.

2、下载下来对应的版本后解压到文件夹下

3、在php.ini中将相应版本的加上,我用的是php5.6,所以加下如下两行

extension=php_pdo_sqlsrv_56_ts.dll
extension=php_pdo_sqlsrv_56_nts.dll

4、php信息查看显示表示php可以连接到sql server

5、再根据上面版本对应下载ODBC Driver 版本

页面错误提示如下提示时:“This extension requires the Microsoft ODBC Driver 11 for SQL Server to communicate with SQL Server. Access the following URL to download the ODBC Driver 11 for SQL Server for x86: http://go.microsoft.com/fwlink/?LinkId=163712”

6、安装完毕后连接成功

你可能感兴趣的:(PHP)