The Microsoft SQL Server Drivers which allow PHP to integrate and connect with the SQL server in the PHP web applications. In this SQL and PHP tutorial, we will discuss how to install and enable Microsft SQL Server Driver for PDO in PHP.
First, you have downloaded the driver file from the official website.
Get the downloaded folder and select the correct driver version for your PHP server.
The dll file name will indicate the PHP version, threadness (ts/nts), and architecture. (You can run phpinfo() function in PHP to check the PHP version of your server.)
Let’s suppose, php_pdo_sqlsrv_74_ts_x64.dll is the 64-bit PDO_SQLSRV driver for thread-safe (ts) PHP 7.4.
Copy the desire version dll library file to your PHP extension directory (php/ext/).
Edit your PHP server configuration file (php.ini) and add the belowgiven line to enable the pdo_sqlsrv extension.
Restart the PHP server and run the following code to check PDO_SQLSRV extension is installed on the server.
<?php phpinfo(); ?>
If the pdo_sqlsrv extension is installed and enabled successfully to your server, you will see the below section in your PHP info screen.