'enable pdo_sqlsrv in php 7.2, not working
I have followed all the guided path,
- download the appropriate sql driver for php 7.2 from https://github.com/Microsoft/msphpsql/releases
- copy and past the ts files to my xampp/php/ext folder,
- enabled the extension from php.ini file
- Restart the xampp and check php info
but I couldn't see the extension enabled in phpinfo

I need to know, is it the version issue or I missed out something.
Solution 1:[1]
- You need to run as an administrator.
- An ODBC driver is missing.
Solution 2:[2]
Installation of PHP Driver for SQL Server can be done following the next steps:
- select and download appropriate version of this driver following Microsoft PHP Drivers for SQL Server Support Matrix.
- download and install an appropriate ODBC driver following System Requirements for the Microsoft Drivers for PHP for SQL Server
- load PHP Driver for SQL Server as PHP extension.
- restart Apache
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 |
