我如何连接PHP 5.5.升级到mssql 2008 R2版本


How can i connect PHP 5.5.x or above version to mssql 2008 R2 in wamp?

如何连接PHP 5.5windowsx或以上版本的mssql 2008 R2版本:PHP: 5.5编译器:MSVC11架构:x86胎面安全:enabled

我尝试了以下步骤:1. 尝试连接sqlsrv_connect()下面的示例代码(test-connect.php):

    <?php
$serverName = "192.168.1.5";
$connectionInfo = array( "Database"=>"testDB", "UID"=>"sa", "PWD"=>"sa123");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
     echo "Connection established.<br />";
}else{
     echo "Connection could not be established.<br />";
     die( print_r( sqlsrv_errors(), true));
}
?>

当我运行file test-connect.php时,它抛出了以下错误:

**"Fatal error: Call to undefined function sqlsrv_connect()"**
  • 我尝试将以下两个DLL文件放入PHP ext文件夹一)php_pdo_sqlsrv_55_nts.dllb) php_sqlsrv_55_nts.dll

  • 并使用以下扩展名更新php.ini扩展= php_sqlsrv_55_ts.dll扩展= php_pdo_sqlsrv_55_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 ) [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 ) )**
    
    谁能帮我解决这个问题?这是Apache/PHP版本的问题吗

    看这里:http://www.iis.net/learn/application-frameworks/install-and-configure-php-on-iis/install-the-sql-server-driver-for-php

    基本上你需要安装一个库这个库的url在你的错误目录中然后把这个库放到php。ini中,像这样

    Extension=php_sqlsrv.dll