Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 连接到Joomla上的SQL Server_Php_Sql Server_Joomla_Joomla3.5 - Fatal编程技术网

Php 连接到Joomla上的SQL Server

Php 连接到Joomla上的SQL Server,php,sql-server,joomla,joomla3.5,Php,Sql Server,Joomla,Joomla3.5,我知道我正在尝试使用此语法从Joomla连接到SQL Server。但是,这会抛出一个错误500——从Joomla连接到SQL Server的正确synatx是什么 if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { $uid = "user"; $pwd = "pwd";

我知道我正在尝试使用此语法从Joomla连接到SQL Server。但是,这会抛出一个
错误500
——从Joomla连接到SQL Server的正确synatx是什么

    if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
    $uid = "user";
    $pwd = "pwd";
    $DB = "database";
    $serverName = "IP";

$connectionInfo = array("UID" => $uid, "PWD" => $pwd, "Database"=> $DB, "ReturnDatesAsStrings" => true);
$conn = sqlsrv_connect( $serverName, $connectionInfo);
// Check connection
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}
编辑
我还尝试了这种语法,还得到了一个500错误-->

编辑
下面是
var\u dump($db)
结果

    object(JDatabaseDriverMssql)[1788]
  public 'name' => string 'mssql' (length=5)
  protected 'nameQuote' => null
  protected 'nullDate' => string '1900-01-01 00:00:00' (length=19)
  private '_database' (JDatabaseDriver) => string 'db' (length=9)
  public 'serverType' => null
  protected 'connection' => null
  protected 'count' => int 0
  protected 'cursor' => null
  protected 'debug' => boolean false
  protected 'limit' => int 0
  protected 'log' => 
    array (size=0)
      empty
  protected 'timings' => 
    array (size=0)
      empty
  protected 'callStacks' => 
    array (size=0)
      empty
  protected 'offset' => int 0
  protected 'options' => 
    array (size=7)
      'driver' => string 'mssql' (length=5)
      'host' => string 'server' (length=25)
      'user' => string 'user' (length=7)
      'password' => string 'pass' (length=9)
      'database' => string 'db' (length=9)
      'prefix' => string '' (length=0)
      'select' => boolean true
  protected 'sql' => null
  protected 'tablePrefix' => string '' (length=0)
  protected 'utf' => boolean true
  protected 'utf8mb4' => boolean false
  protected 'errorNum' => int 0
  protected 'errorMsg' => null
  protected 'transactionDepth' => int 0
  protected 'disconnectHandlers' => 
    array (size=0)
      empty
在此块中,您应更改此行:

$option['driver'] = 'mssql'; 

如果您想使用JDatabase,SQLSRV是唯一一个与Joomla一起工作的sqlserver驱动程序

此外,您应该检查PHP配置,可能没有安装SQL驱动程序

哦。。再一个。在这里:

$db = &JDatabase::getInstance($option);
我在等待反馈,如果有用的话给我信息

在此块中,您应更改此行:

$option['driver'] = 'mssql'; 

如果您想使用JDatabase,SQLSRV是唯一一个与Joomla一起工作的sqlserver驱动程序

此外,您应该检查PHP配置,可能没有安装SQL驱动程序

哦。。再一个。在这里:

$db = &JDatabase::getInstance($option);

我在等待反馈,如果有用,请给我信息。

进行
var\u转储($db);退出
after
$db=JDatabase::getInstance($option)发布结果here@AmitRay-编辑帖子以显示结果。执行
var\u转储($db);退出
after
$db=JDatabase::getInstance($option)发布结果here@AmitRay-编辑帖子以显示结果。
$db = &JDatabase::getInstance($option);