Home >php教程 >php手册 >php5.3如何连接mssql

php5.3如何连接mssql

WBOY
WBOYOriginal
2016-06-06 20:09:20970browse

windows系统下,PHP5.3以上的版本已经不支持mssql扩展。 首先http://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx? 点击 get it 下载SQLSRV20.EXE。 将文件解压到php的扩展文件夹ext下。 打开php.ini在结尾添加 [PHP_PDO_SQLSRV] extension=php_pdo_sq

windows系统下,PHP5.3以上的版本已经不支持mssql扩展。

首先http://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx? 点击 get it 下载SQLSRV20.EXE。

将文件解压到php的扩展文件夹ext下。

打开php.ini在结尾添加

[PHP_PDO_SQLSRV]
extension=php_pdo_sqlsrv_53_nts_vc6.dll
[PHP_SQLSRV]
extension=php_sqlsrv_53_nts_vc6.dll

保存后重启apache即可。附上简单的php连接的例子:

<?php $serverName = “(127.0.0.1)”;
$connectionInfo = array( “UID”=>”root”,
“PWD”=>”root2010″,
“Database”=>”master”);
$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));
}
?>

我使用的是wamp5.1集成安装包。在windows server 2008上面做的测试。php5.4以上版本测试没有成功。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn