[英]SQLSRV driver installed but shows error while connecting to MSSQL 2008 R2 db using PHP
我有一台運行Windows 7 Professional,MSSQL 2008 R2和IIS 7.5的筆記本電腦。 系統在c#和php中成功運行了我的所有應用程序。 現在,我想在裝有Windows 7 Ultimate的第二台筆記本電腦上傳輸所有文件和應用程序。 但是由於某種原因,即使phpinfo() 顯示已安裝sqlsrv ,我也無法成功連接到數據庫,並且我使用的是完全相同的代碼,只是更改了數據庫的連接字符串。
我有MSSQL Management Studio v 10.50.2500
IIS v 7.5.7600.16385
PHP v 5.5.3
適用於php 5.5的SQLSRV驅動程序(它不是正式的MS版本,但非常流行,並且可以在我以前的筆記本電腦上使用)
我收到類似這樣的錯誤:
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
)
)
我的PHP代碼如下(我知道它可以在第一台筆記本電腦上工作):
`$serverName = "DELL-PC"; //serverName\instanceName`
``
`$connectionInfo = array( "Database"=>"amlTest");`
`$conn = sqlsrv_connect( $serverName, $connectionInfo);`
我只是無法弄清楚問題出在哪里,或者我在哪里錯過了? 我真的需要這個工作! 並且花了太多時間重新安裝我的所有軟件並嘗試所有php版本。
我希望不是因為Windows版本的差異
另外,對不起,如果我在設置問題格式時遇到任何錯誤,因為這是我的第一篇文章。
您是否安裝了功能包?
http://microsoft.com/en-us/download/details.aspx?id=29065
錯誤提示告訴我們,您需要2012版的MS SQL Server才能正常工作。 另外,請確保正確設置服務器權限。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.