msphpsql: PDO::ATTR_SERVER_VERSION not supported by driver on Mac
Using Laravel Framework we run into this error when executing laravel db migrations. Unixodbc version 2.3.7 is installed.
PHP Driver version or file name
pdo_sqlsrv 5.3.0 , sqlsrv 5.3.0
SQL Server version
Azure SQL Database
Client operating system
Mac OS High Sierra
PHP version
PHP 7.2.9
Microsoft ODBC Driver version
msodbcsql17 17.2.0.1 unixodbc 2.3.7
Problem description
Error in Doctrine:
SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute
https://github.com/doctrine/dbal/blob/50d3c465d026ecf38c1e477f36da5f9124bf8bd4/lib/Doctrine/DBAL/Driver/PDOConnection.php#L50
Expected behavior and actual behavior
attribute should be available This issue #756 states that the unixodbc version is causing this problem. Latest version is installed and problem still occurs on Mac.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 16 (8 by maintainers)
This behaviour was fixed in laravel version 5.7. Details on the fix are available here. All versions below 5.7 use dblib as the default - if available. Since we installed php via homebrew, which ships with freetds, dblib was always used as the default on our systems.
@david-puglielli thank you for your help. I have now found the cause of the problem. It is indeed not related to the sqlsrv extensions. My version of the laravel framework uses dblib to connect to the DB - ignoring the sqlsrv drivers. This behaviour is fixed in the latest laravel framework version.