简体   繁体   中英

Call to undefined function sqlsrv_connect() in C:\wamp\www\Webs\client.php on line 7

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

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

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

pls, i need somebody to help me on this, i will really appreciate

很抱歉,如果来不及回答,但我有同样的错误,我发现Wamp Server 64bit不支持SQL Server连接,你必须安装一个32位版本的wamp服务器。

For those using 64-bit systems (OS, WAMP, MSSQL), these 64-bit drivers can serve them and fix the error:

Fatal error: Call to undefined function sqlsrv_connect() in C:\\wamp\\www...

Drivers SQLSRV x64:

http://robsphp.blogspot.in/2012/06/unofficial-microsoft-sql-server-driver.html

You'll need to install and enable sqlsrv on your web server. Have a look at the installation page on the official PHP website.

Installation of Microsoft Drivers 3.0 for PHP for SQL Server will fix this issue. Also try this PHP Manual .

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.

Source

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

http://www.iis.net/learn/application-frameworks/running-php-applications-on-iis/set-up-fastcgi-for-php .

It simple and nice, now i can connect to both sql server 2005 and 2008

My PHP Details
Version => 5.3.5
Compiler => MSVC6 (Visual C++ 6.0)
SqlSrv Driver => php_sqlsrv_53_ts_vc6.dll

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM