问题描述
我安装了xampp-win32-7.2.11-0-VC15-installer.exe,将SQLSRV53.EXE下载并解压到C:\xampp\php\ext,添加
I installed xampp-win32-7.2.11-0-VC15-installer.exe, downloaded and extracted SQLSRV53.EXE to C:\xampp\php\ext, added
;extension=php_sqlsrv_72_ts_x64.dll
;extension=php_sqlsrv_72_ts_x64.dll
;extension=php_pdo_sqlsrv_72_ts_x64.dll
;extension=php_pdo_sqlsrv_72_ts_x64.dll
到 php.ini 仍然得到 Uncaught Error: Call to undefined function sqlsrv_connect()
to php.ini and still get Uncaught Error: Call to undefined function sqlsrv_connect()
我的代码:
<?php
$serverName = "XXXXX\SQLEXPRESS"; //serverName\instanceName
// Since UID and PWD are not specified in the $connectionInfo array,
// The connection will be attempted using Windows Authentication.
$connectionInfo = array( "Database"=>"XXXX");
$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));
}
?>
推荐答案
1) php_sqlsrv_72_ts_x64 AND php_pdo_sqlsrv_72_ts_x64 应该是 32 位与 xampp 相同
1) php_sqlsrv_72_ts_x64 AND php_pdo_sqlsrv_72_ts_x64 should be 32 bit same as xampp
2) 也兼容 PHP 版本
2) Also compatible with PHP version
这篇关于未捕获的错误:调用未定义的函数 sqlsrv_connect()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!