Home >Backend Development >PHP Tutorial >php5.2.3 connects to sqlserver2008

php5.2.3 connects to sqlserver2008

WBOY
WBOYOriginal
2016-08-08 09:25:371212browse

1, Download driver

Download address: https://www.microsoft.com/en-us/download/details.aspx?id=20098

What I downloaded is: SQLSRV20.EXE because my php version is 5.2.3. Please see the download instructions for the specific version.

2, Unzip SQLSRV20.EXE,

3. Modify php.ini and add extension=php_sqlsrv_52_ts_vc6.dll

4, copy extension=php_sqlsrv_52_ts_vc6.dll

5, restart the server

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

The above introduces how to connect php5.2.3 to sqlserver2008, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

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