【问题标题】:SQL Connect Via PHP [closed]通过 PHP 连接 SQL [关闭]
【发布时间】:2013-07-18 20:14:53
【问题描述】:
   $serverName = "172.20.90.100"; 

   // Since UID and PWD are not specified in the $connectionInfo array,
   // The connection will be attempted using Windows Authentication.

   $connectionInfo = array( "Database"=>"correctdb");
   $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));
   }    

这给了我这个错误:

致命错误:在第 23 行调用未定义函数 sqlsrv_connect()

我想知道我应该改变什么来建立连接。

【问题讨论】:

  • 那里不是23行吗?
  • @rowlandshaw 我把这部分复制出来,另一部分是注释代码

标签: php sql connection


【解决方案1】:

sqlsrv_connect() 是嵌入在 SQL Server 扩展中的 php 函数。该错误表明您尚未启用它。

您必须启用扩展程序。描述了这是如何完成的here in the manual.

【讨论】:

  • @Bjoem 如果你不忙,我们可以建立一个聊天室吗,我有几个小问题要问你。
【解决方案2】:
  • 如果您尚未安装 Microsoft Drivers 3.0 for PHP for SQL Server,请从 here 安装。

  • 确保您的php.ini 中有这些行:

    extension=php_pdo_sqlsrv_53_ts.dll
    extension=php_sqlsrv_53_ts.dll
    

文档:sqlsrv_connect()

【讨论】:

  • 我们可以建立一个聊天室吗?我只是想问几个问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-03-29
  • 2018-06-30
  • 1970-01-01
  • 2018-03-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多