PHP7 does not work with SQL Server 2014

1

I have a project running on Xampp with PHP 5.6 and SQL Server 2014 Express. I am trying to migrate the project to PHP 7.1.0 but it is giving error as picture below.

I copied the dlls to the PHP ext folder which is in c: \ php7 \ ext. The four dlls are presenting the error below.
I'm using Apache 2.4.23 and PHP 7.1.0.

extension=php_sqlsrv.dll
extension=php_pdo_sqlsrv.dll
extension=php_pdo_sqlsrv_7_ts.dll
extension=php_sqlsrv_7_ts.dll
    
asked by anonymous 13.12.2016 / 17:12

1 answer

3

PHP Extension DLLs are compiled to work in a single version of PHP. The PHP 5.6 DLL will crash in PHP 7, and the 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

If you also notice that PHP is compiled from two forms in Windows : thread safe 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 a build for x64 and another 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.

    
16.12.2016 / 06:34