无法调用函数sqlsrv_connect() [英] Cannot Call function sqlsrv_connect()

查看:239
本文介绍了无法调用函数sqlsrv_connect()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过了几个问题和建议来解决上述问题,但是一点都不幸运.

I went through several questions and recommendation to resolve the above issue, but No luck at all.

我有以下设置:

Windows Server 2008 R2

Windows Server 2008 R2

x ampp-win32-1.8.2-5-VC9-installer

xampp-win32-1.8.2-5-VC9-installer

SQLSRV30-PHP驱动程序

SQLSRV30 - php driver

sqlncli-Microsoft SQL Server 2008 R2本机客户端设置

sqlncli - Microsoft SQL Server 2008 R2 Native Client Set Up

我安装了所有其他内容,并且在php.ini文件中包含以下内容 下面的代码显示php驱动程序所在的位置:

I installed everything else and I have the following on the php.ini file The code below show where the php drivers are residing:

; On windows:
extension_dir="C:\xampp\php\ext"

以下是Windows扩展程序下的

The following is under windows extensions

extension=php_pdo_sqlsrv_54_ts.dll
extension=php_sqlsrv_54_ts.dll

当我检查phpinfo文件sqlsrv时未列出.我知道这可能意味着它尚未安装,但已安装.

When I check the phpinfo file sqlsrv is not listed. I know this may imply that its not installed, but It is installed.

以下是php信息文件:

The following is the php info file:

我还重新启动了apache和服务器.我想念什么吗?

I also restarted apache and the server. Am I missing something ?

我收到以下错误:

调用未定义函数sqlsrv_connect()

Call to undefined function sqlsrv_connect()

这是我用来连接的代码:我正在连接到另一台托管SQL Server 2005的服务器

This the code I am using to connect: I am connecting to another server which is hosting SQL Server 2005

/Connection to SQL Server Database
    error_reporting(E_ALL);
$serverName = "172.xx.x.xxx";

$connectionInfo = array('Database'=>'Eque', "UID"=>"develop", "PWD"=>"develop");
$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));
}

推荐答案

我在整个过程中都遇到了麻烦,这终于奏效了.我在Sql Express 2008 R2中使用php 5.4.16和Apache 2.4.4.

I have struggled through the process and this is what has finally worked. I am using php 5.4.16 and Apache 2.4.4 with Sql Express 2008 R2.

  1. 下载用于SQL Server的PHP的Microsoft驱动程序.微软下载站点

将文件完全保存到本地文件夹

Extact the files to a local folder

这篇关于无法调用函数sqlsrv_connect()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆