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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM