To install Microsoft SQL Server PDO driver on Windows, follow these steps:
Download the latest version of the Microsoft Drivers for PHP for SQL Server from here.
Extract the downloaded file and copy the php_sqlsrv_XXX
and php_pdo_sqlsrv_XXX
folders to your PHP ext/
directory.
Open your php.ini
file and add the following lines to enable the extensions:
main.php62 chars3 lines
Replace the XXX
with the appropriate version number.
Save and close php.ini
file.
Restart your web server.
To verify that the drivers are successfully installed, create a new PHP file with the following code:
main.php409 chars16 lines
Replace the your_server_name
, your_database_name
, your_username
and your_password
with your own information.
If the connection is successful, you should see a message saying "Connected successfully".
gistlibby LogSnag