sql2005-axmpp 的php连接SQL2005有错误,麻烦各位指导一下
错误是Fatal error: Call to undefined function sqlsrv_connect() in D:\xampp\htdocs\test\connsql.php on line 17
我是这样做的:
要到http://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx自行下载微软提供的The SQL Server Driver for PHP。
下载后解压缩,将所有的.dll文件拷贝到php安装目录的ext文件夹中,接下来打开php.ini,添加以下语句打开php_sqlsrv和php_pdo_sqlsrv扩展:
——————————————————–
[PHP_PDO_SQLSRV]
extension=php_pdo_sqlsrv_56_ts_vc6.dll
[PHP_SQLSRV]
extension=php_sqlsrv_56_ts_vc6.dll
—————————————————
按照上边的做了,同时安装了Microsoft Microsoft SQL Server 2008 R2 Native Client MSI,还是有错
这是我的链接语句
//本地测试的服务名
$serverName = "(127.0.0.1)";
$connectionInfo = array( "UID”=>”sa",
"PWD"=>"123456",
"Database"=>"FPAttendance");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn )
{
echo "Connection established.\n";
}
else
{
echo "Connection could not be established.\n";
die( print_r( sqlsrv_errors(), true));
}
?>
错误是Fatal error: Call to undefined function sqlsrv_connect() in D:\xampp\htdocs\test\connsql.php on line 17