第 7 行调用 C:\wamp\www\Webs\client.php 中未定义的函数 sqlsrv_connect()
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18459658/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Call to undefined function sqlsrv_connect() in C:\wamp\www\Webs\client.php on line 7
提问by yommy
Am using windows 8 pro, Wamp server (php V5.3.5, apache V2.2.17), Sql server 2005 express editon. I have downloaded the sqlsrv drivers and extracted them into the php extention folder (C:\wamp\bin\php\php5.3.5\ext
), have also update the php.ini file by adding the extentions
我使用的是 windows 8 pro、Wamp 服务器(php V5.3.5、apache V2.2.17)、Sql server 2005 express 版。我已经下载了 sqlsrv 驱动程序并将它们解压缩到 php 扩展文件夹(C:\wamp\bin\php\php5.3.5\ext
)中,还通过添加扩展更新了 php.ini 文件
extension=php_sqlsrv_53_ts_vc6.dll
extension=php_pdo_sqlsrv_53_ts_vc6.dll
I used this two after series of try and error on all the dll file, it was this two that come up with no error, when restarting the wamp server
我在所有dll文件上经过一系列尝试和错误后使用了这两个,重新启动wamp服务器时,这两个没有出现错误
This is the connection line of code;
这是代码的连接线;
$con = sqlsrv_connect('TAQUATECH\SQLEXPRESS') or die("cannot connect");
It came up with the following error;
它提出了以下错误;
Fatal error: Call to undefined function sqlsrv_connect() in C:\wamp\www\Webs\client.php on line 7
致命错误:在第 7 行调用 C:\wamp\www\Webs\client.php 中未定义的函数 sqlsrv_connect()
pls, i need somebody to help me on this, i will really appreciate
请,我需要有人帮助我,我会非常感激
回答by AliAwwad
Sorry if too late to answer, but I had the same error, and I found out that Wamp Server 64bit does not support SQL Server Connection, you must install a 32bit version of wamp server.
对不起,如果来不及回答,但我有同样的错误,我发现Wamp Server 64bit 不支持SQL Server Connection,您必须安装32bit 版本的wamp server。
回答by SkyMaster
For those using 64-bit systems (OS, WAMP, MSSQL), these 64-bit drivers can serve them and fix the error:
对于使用 64 位系统(OS、WAMP、MSSQL)的用户,这些 64 位驱动程序可以为它们提供服务并修复错误:
Fatal error: Call to undefined function sqlsrv_connect() in C:\wamp\www...
致命错误:调用 C:\wamp\www 中未定义的函数 sqlsrv_connect()...
Drivers SQLSRV x64:
驱动程序 SQLSRV x64:
http://robsphp.blogspot.in/2012/06/unofficial-microsoft-sql-server-driver.html
http://robsphp.blogspot.in/2012/06/unofficial-microsoft-sql-server-driver.html
回答by Khan
use 32 bit PHP Version.
enable below one of them in php.ini
[PHP_PDO_SQLSRV_53_NTS]
extension=php_pdo_sqlsrv_53_nts.dll
[PHP_SQLSRV_54_NTS]
extension=php_sqlsrv_54_nts.dll
[PHP_SQLSRV_53_NTS]
extension=php_sqlsrv_53_nts.dll
[PHP_PDO_SQLSRV_54_NTS]
extension=php_pdo_sqlsrv_54_nts.dll
thease dll version you can downlowd online
回答by Wayne Whitty
You'll need to install and enable sqlsrv on your web server. Have a look at the installation pageon the official PHP website.
您需要在 Web 服务器上安装并启用 sqlsrv。看看官方 PHP 网站上的安装页面。
回答by Shankar Damodaran
Installationof Microsoft Drivers 3.0 for PHP for SQL Server will fix this issue. Also try this PHP Manual.
安装Microsoft Drivers 3.0 for PHP for SQL Server 将解决此问题。也试试这个PHP 手册。
EDIT :
编辑 :
The most recent version of the driver is available for download here: ? SQLSRV 3.0 download. If you need support for PHP 5.2 and/or PHP compiled with VC6, use the 2.0 release of the driver: ? SQLSRV 2.0 download.
可以在此处下载最新版本的驱动程序: ? SQLSRV 3.0 下载。如果您需要支持 PHP 5.2 和/或用 VC6 编译的 PHP,请使用驱动程序的 2.0 版本:SQLSRV 2.0 下载。
回答by yommy
Yap, I have gotten a work-around;
The problem was, running the php script using apache server on my system, I stoped the wamp server and configure fastCGI for PHP using IIS 7, You can get a video tutorial Here
是的,我已经找到了解决方法;
问题是,在我的系统上使用 apache 服务器运行 php 脚本,我停止了 wamp 服务器并使用 IIS 7 为 PHP 配置了 fastCGI,您可以在此处获得视频教程
It simple and nice, now i can connect to both sql server 2005 and 2008
简单又好用,现在我可以连接到 sql server 2005 和 2008
My PHP Details
Version => 5.3.5
Compiler => MSVC6 (Visual C++ 6.0)
SqlSrv Driver => php_sqlsrv_53_ts_vc6.dll
我的 PHP 详细信息
版本 => 5.3.5
编译器 => MSVC6 (Visual C++ 6.0)
SqlSrv 驱动程序 => php_sqlsrv_53_ts_vc6.dll