Eug*_*gen 6 php wamp sql-server-2008
我需要通过PHP(WAMP,最新版本)连接到SQL Server 2008.我安装并设置了sqlsrv驱动程序,它们确实显示在phpinfo()
.
我使用以下行使用Windows身份验证连接到我的数据库:
$serverName = "(local)";
$connectionOptions = array("Database"=>"MyTestDatabase");
$conn = sqlsrv_connect( $serverName, $connectionOptions) or die("Error!");
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Array
(
[0] => Array
(
[0] => IMSSP
[SQLSTATE] => IMSSP
[1] => -49
[code] => -49
[2] => This extension requires the Microsoft SQL Server 2011 Native Client. Access the following URL to download the Microsoft SQL Server 2011 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712
[message] => This extension requires the Microsoft SQL Server 2011 Native Client. Access the following URL to download the Microsoft SQL Server 2011 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
)
)
Run Code Online (Sandbox Code Playgroud)
任何帮助都会很棒,但请具体说明,因为除了一些基础知识之外,我真的不知道我在WAMP周围的路.
该错误是由注册表中的权限问题引起的。有一个密钥存储了本机客户端的路径,并且您在应用程序池中使用的身份被拒绝访问。
查找进程w3wp.exe
被拒绝访问的注册表项。对于 IIS,不确定 WAMP 中的进程名称是什么,但过程是相同的。就我而言:
HKLM\Software\ODBC\ODBCINST.INI\SQL Native Client 10.0
Run Code Online (Sandbox Code Playgroud)