After decompression, select 32 or 64 bit extensions according to PHP version, and notice Thread safe(NTS and TS).
TS refers to Thread Safety, which is generally selected when IIS is loaded in ISAPI mode.
NTS refers to None-Thread Safe,which is generally selected when running in fast CGI mode, which has better performance.
3 Copy the files needed to the PHP extension directory
Put them in the corresponding version of PHP directory.
(For example, use php_pdo_sqlsrv_7_nts_x86.dll and php_sqlsrv_7_nts_x86.dll).
4 Modify php.ini
Add the following two lines in “php.ini” to enable extensions:
extension=php_sqlsrv_7_nts_x86.dll
extension=php_pdo_sqlsrv_7_nts_x86.dll
or
5 Install ODBC Driver(if not installed)
ODBC Driver:
Microsoft® ODBC Driver 11 for SQL Server® - Windows (SQL Server® 2005):
Microsoft® ODBC Driver 13 for SQL Server® - Windows + Linux (SQL Server® 2016)
6 How to check if we have enabled SQL extension in PHP7.0.0+ or not
6.1 Create file “phpinfo.php” in the root directory of the website
Browser access xxx.xxx.xxx.xxx/phpinfo.php
6.2 Create file “test.php” in the root directory of the website
<?php
$serverName = "xxx.xxx.xxx.xxx"; //serverName\instanceName
$connectionInfo = array( "Database"=>"databasename_here", "UID"=>"username_here", "PWD"=>"password_here");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}
?>
Browser access http://xxx.xxx.xxx.xxx/test.php