'enable pdo_sqlsrv in php 7.2, not working

I have followed all the guided path,

  1. download the appropriate sql driver for php 7.2 from https://github.com/Microsoft/msphpsql/releases
  2. copy and past the ts files to my xampp/php/ext folder,
  3. enabled the extension from php.ini file
  4. Restart the xampp and check php info but I couldn't see the extension enabled in phpinfo enter image description here

I need to know, is it the version issue or I missed out something.



Solution 1:[1]

  1. You need to run as an administrator.
  2. An ODBC driver is missing.

Solution 2:[2]

Installation of PHP Driver for SQL Server can be done following the next steps:

Example:

<?php
# Info
$server   = 'server\instance,port';
$database = 'database';
$username = 'username';
$password = 'password';

# Connect
try {
    $conn = new PDO("sqlsrv:server=$server;Database=$database", $username, $password);
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
    die("Error connecting to SQL Server".$e->getMessage());
}

# End
echo 'Connected';
$conn = null;
?>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2