PHP extension Dlls are compiled to work in a single version of PHP. The PHP 5.6 DLL will lock in PHP 7, and the PHP 7 DLL will lock in PHP 7.1. So, at first, make sure you’re using only the correct version in the ext
and in the php.ini
Also note that PHP is compiled from two ways in Windows: thread safe and non thread safe. This also influences which extension you should use.
From PHP 7 we also have a compilation for x64 and another for x86. Again, you need to choose the correct version here too.
Assuming you’re using the version Thread Safe (the one that comes along with XAMPP/Apache generally), download the latest extension to work with SQL Server. The easiest way is to look at the Github driver repository, in the releases part and download only the version you want.
Today support for PHP 7.1 is still in preview, and the latest version that’s the one.
Download only the zip for PHP 7.1, choose the architecture, thread safe or not, and extract only them in the folder ext
and insert into php.ini
.
// suporte PDO
extension=php_pdo_sqlsrv_71_ts.dll
// sem PDO
extension=php_sqlsrv_71_ts.dll
Finally, if it doesn’t work out, you may need to update the Microsoft ODBC Driver 13 for SQL Server. SQL Server Express 2014 uses version 11 of this driver for connection, and so I don’t know if the new version of the PHP driver needs you to update ODBC as well.
Installed Microsoft Drivers 4.0 for PHP for SQL Server?
– José Diz
Quotation marks. Installing is a compressed file.
– fabricio_wm
What you do is unzip dll in the ext folder and make php.ini see these dll.
– fabricio_wm
That’s right; extract the contents of SQLSRV40.EXE from the extensions directory.
– José Diz
Blz. But why doesn’t it work? Do you have any idea what might be going on?
– fabricio_wm