Home > php教程 > php手册 > php5.2.3连接sqlserver2008,sqlserver2008

php5.2.3连接sqlserver2008,sqlserver2008

WBOY
Release: 2016-06-13 09:06:17
Original
1390 people have browsed it

php5.2.3连接sqlserver2008,sqlserver2008

1,下载驱动 

下载地址:https://www.microsoft.com/en-us/download/details.aspx?id=20098

我下载的是:SQLSRV20.EXE ,因为我的php版本是5.2.3。具体的版本可以看下载说明。

2,解压SQLSRV20.EXE,

3,修改php.ini,添加 extension=php_sqlsrv_52_ts_vc6.dll

4,拷贝 extension=php_sqlsrv_52_ts_vc6.dll

5,重启服务器

$server = '(local)';
$user = 'sa';
$pass='sa';
$dbname='testdb';
if(sqlsrv_connect($server, array('UID' => $user ,'PWD'=> $pass, 'Database' => $dbname)))
{
    echo "成功";
}
else
{
    echo "失败";
}
?>

 

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template