使用PHP

时间:2018-05-07 12:11:17

标签: php sql-server

我收到了这个错误:

  

“此扩展程序需要SQL Server的Microsoft ODBC驱动程序。   访问以下URL以下载SQL Server的ODBC驱动程序   对于x64:https://go.microsoft.com/fwlink/?LinkId=163712

和这一个:

  

“[Microsoft] [ODBC驱动程序管理器]未找到数据源名称且没有   默认驱动程序指定“

我已在此消息中安装了ODBC Driver之类的说法。 我在我的php.ini扩展程序中添加了IIS,但仍然是错误。

PHP version: 7.2.
Windows: Windows Server 2008 R2 x64
Sql Server: 2012 express

我的phpinfo PHPInfo

有人可以帮助我吗?

使用的代码(简单sqlsrv_connect)

$serverName = $this->host;
$connectionInfo["Database"] = $this->banco;
if ($this->user) $connectionInfo["UID"] = $this->user;
if ($this->pass) $connectionInfo["PWD"] = $this->pass;
if ($this->port) $serverName.=', '.$this->port;
$this->id_db = sqlsrv_connect( $serverName, $connectionInfo);

完整的错误消息:

array(2) { 
    [0]=> array(6) { 
       [0]=> string(5) "IMSSP" 
       ["SQLSTATE"]=> string(5) "IMSSP" 
       [1]=> int(-49) 
       ["code"]=> int(-49) 
       [2]=> string(189) "This extension requires the Microsoft ODBC Driver for SQL Server. Access the following URL to download the ODBC Driver for SQL Server for x64: https://go.microsoft.com/fwlink/?LinkId=163712" 
       ["message"]=> string(189) "This extension requires the Microsoft ODBC Driver for SQL Server. Access the following URL to download the ODBC Driver for SQL Server for x64: https://go.microsoft.com/fwlink/?LinkId=163712" 
    } 
    [1]=> array(6) { 
       [0]=> string(5) "IM002" 
       ["SQLSTATE"]=> string(5) "IM002" 
       [1]=> int(0) 
       ["code"]=> int(0) 
       [2]=> string(91) "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified" 
       ["message"]=> string(91) "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified" 
    } 
    }

0 个答案:

没有答案