Explanations:
MSSQL extension (mssql_
functions) is not available anymore on Windows with PHP 5.3 or later.
Warning This feature was REMOVED in PHP 7.0.0.
Alternatives to this feature include: PDO_SQLSRV PDO_ODBC SQLSRV
Unified ODBC API These functions allow you to access MS SQL Server
database.
This extension is not available anymore on Windows with PHP 5.3 or
later.
Solution:
What you can do is to install PHP Driver for SQL Server. You need to download the appropriate version of this driver. For PHP 5.6 - version 3.2 (32-bit or 64-bit also depends on PHP version). Also download and install an appropriate ODBC driver.
Sample script:
<?php
$serverName = "server\instance,port";
$connectionInfo = array(
"UID" => "username",
"PWD" => "password",
"Database" => "database"
);
$conn = sqlsrv_connect($serverName, $connectionInfo);
if ($conn === false) {
echo "Unable to connect.</br>";
exit;
} else {
echo "Connected.</br>";
}
// Other code here ...
sqlsrv_close($conn);
?>