> For the complete documentation index, see [llms.txt](https://learnsql.gitbook.io/lernmysql/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learnsql.gitbook.io/lernmysql/full-text-search/sql-server-connection-to-sql-server-from-classic-asp-ok.md).

# \[SQL SERVER] Connection to SQL Server from classic ASP (ok)

Download dll

{% embed url="<https://github.com/microsoft/msphpsql/releases/tag/v5.7.0-preview>" %}

{% file src="/files/-Mfeu2YtyD8yogjmg3zc" %}

C:\xampp\php\ext

![](/files/-MfeuQ99yIrGyv6wcKrW)

![](/files/-MfeuTGIdX6AJlEH9_pR)

![](/files/-MfeuW4sMG_zUljEUNO5)

Làm theo cái này chuẩn&#x20;

Tải ở đây <https://docs.microsoft.com/en-us/sql/connect/php/download-drivers-php-sql-server?view=sql-server-ver15>

```
extension=php_sqlsrv_74_ts_x64.dll
extension=php_pdo_sqlsrv_74_ts_x64.dll
```

![](/files/-MffDoEqoDv-Nwrozl-z)

C:\xampp\php\php.ini

file php

```
<?php
$serverName = "LIONEL"; //serverName\instanceName

// Since UID and PWD are not specified in the $connectionInfo array,
// The connection will be attempted using Windows Authentication.
$connectionInfo = array(
	'Database'=>'TutorialDB',
	'UID'=>'test', 
	'PWD'=>'lionel123'
);
$conn = sqlsrv_connect( $serverName, $connectionInfo);

if( $conn ) {
     echo "Connection established.<br />";
}else{
     echo '<pre>';
     	var_export(sqlsrv_errors());
     echo '</pre>';
}
?>
```
