First published on MSDN on Mar 27, 2018
Hi all,

We are excited to announce the production ready release for the Microsoft Drivers 5.2.0 for PHP for SQL Server . The drivers now support basic select/insert/update/delete functionality with the Always Encrypted feature. The driver enables access to SQL Server, Azure SQL Database and Azure SQL DW from PHP 7.0-7.2 applications on Linux, Windows and macOS.

Notable items about 5.2.0 since 4.3.0:


  • Added support for Always Encrypted (see Features )

    • Support for Windows Certificate Store

    • Support for inserting into and modifying an encrypted column

    • Support for fetching from an encrypted column

  • Added support for PHP 7.2

  • Added support for Microsoft ODBC Driver 17 for SQL Server

  • Added support for Ubuntu 17 (requires Microsoft ODBC Driver 17 for SQL Server)

  • Added support for Debian 9 (requires Microsoft ODBC Driver 17 for SQL Server)

  • Added support for SUSE 12

  • Added Driver option to specify the Microsoft ODBC driver

    • Valid options are "ODBC Driver 17 for SQL Server", "ODBC Driver 13 for SQL Server", and "ODBC Driver 11 for SQL Server"

    • The default driver is ODBC Driver 17 for SQL Server


  • Implementation of PDO::lastInsertId($name) to return the last inserted sequence number if the sequence name is supplied to the function ( lastInsertId )


  • Issue #555 - Hebrew strings truncation (requires Microsoft ODBC Driver 17)

  • Adjusted precisions for numeric/decimal inputs with Always Encrypted

  • Support for non-UTF8 locales in Linux and macOS

  • Fixed crash caused by executing an invalid query in a transaction (Issue #434 )

  • Added error handling for using PDO::SQLSRV_ATTR_DIRECT_QUERY or PDO::ATTR_EMULATE_PREPARES in a Column Encryption enabled connection

  • Added error handling for binding TEXT, NTEXT or IMAGE as output parameter (Issue #231 )

  • PDO::quote with string containing ASCII NUL character (Issue #538 )

  • Decimal types with no decimals are correctly handled when Always Encrypted is enabled (PR #544 )

  • BIGINT as an output param no longer results in value out of range exception when the returned value is larger than a maximum integer ( PR #567 )


  • Dropped support for Ubuntu 15

  • Supplying tablename into PDO::lastInsertId($name) no longer return the last inserted row ( lastInsertId )


  • Always Encrypted is not supported in Linux and macOS

  • In Linux and macOS, setlocale() only takes effect if it is invoked before the first connection. Attempting to set the locale after connection will not work

  • Always Encrypted functionalities are only supported using MS ODBC Driver 17

  • Always Encrypted limitations

  • When using sqlsrv_query with Always Encrypted feature, SQL type has to be specified for each input (see here )

  • No support for inout / output params when using sql_variant type

Known Issues

  • Connection pooling on Linux doesn't may not work properly when using Microsoft ODBC Driver 17 unixODBC < 2.3.6

  • When pooling is enabled in Linux or macOS

    • unixODBC <= 2.3.4 (Linux and macOS) might not return proper diagnostics information, such as error messages, warnings and informative messages

    • due to this unixODBC bug, fetch large data (such as xml, binary) as streams as a workaround. See the examples here

  • Connection with Connection Resiliency enabled does not resume properly with Connection Pooling (Issue #678 ) - Fixed with MS ODBC Driver 17.1

  • With ColumnEncryption enabled, calling stored procedure with XML parameter does not work (Issue #674 )

  • Cannot connect with both Connection Resiliency enabled and ColumnEncryption enabled (Issue #577 )

  • With ColumnEncryption enabled, retrieving a negative decimal value as output parameter causes truncation of the last digit (Issue #705 )

  • With ColumnEncryption enabled, cannot insert a double into a decimal column with precision and scale of (38, 38) (Issue #706 )

  • With ColumnEncryption enabled, when fetching decimals as output parameters bound to PDO::PARAM_BOOL or PDO::PARAM_INT, floats are returned, not integers (Issue #707 )


Let us know how we are doing and how you use our driver by taking our pulse survey: https://aka.ms/mssqlphpsurvey

Get Started

Direct downloads can be found on the Github release tag .

David Engel