Maybe you should try the PDO with the SQLsrv plugin (this is what I'm using to connect to my other boss's software that uses the SQL Server 2014 database):
$connection = new PDO("sqlsrv:Server=" . $server . ";Database=" . $database, $username, $password);
$connection->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
You can download the plugin here
link
In Xampp, you should copy the dll into the folder:
C:\xampp\php\ext
And you should add this line to your php.ini
extension = php_pdo_sqlsrv_56_ts.dll
Note :
Do not forget to restart your server so that it can take into account the new php.ini file.
OBS. PHP 7
PHP Extension DLLs are compiled to work in a single version of PHP. The PHP 5.6 DLL will crash in PHP 7, and that of PHP 7 will also crash in PHP 7.1. So first make sure that you are using only the correct version in the folder ext
and php.ini
Also note that PHP is compiled from two forms in Windows : thread safe
strong> and non thread safe . This also influences which extension you should use (again, do not mix garlic with bugs).
Oh, almost forgetting, as of PHP 7 we also have one compile for x64 and one for x86. Again, you have to choose the correct version here too.
Assuming you are using the Thread Safe version (which comes with XAMPP / Apache generally), download the latest extension to work with SQL Server. The easiest way is look in the github repository of the driver in the releases part and download only the version you want.
Now support for PHP 7.1 is still in preview, and the latest is this .
Download only the zip for PHP 7.1, choose the architecture, thread safe or not, and extract only them in the ext
folder and enter in php.ini
.
// suporte PDO
extension=php_pdo_sqlsrv_71_ts.dll
// sem PDO
extension=php_sqlsrv_71_ts.dll
Finally, if something goes wrong, you may also need to update Microsoft ODBC Driver 13 for SQL Server . SQL Server Express 2014 uses version 11 must driver for connection, and as a reminder do not know if the new version of the driver for PHP needs you to update ODBC as well.