Reputation: 673
I'm trying to get mssql drivers to work.
I downloaded the pdo driver from microsoft, put the file php_pdo_sqlsrv_7_nts_x64.dll
into C:\Program Files\PHP\ext
and edited php.ini
to add extension=php_pdo_sqlsrv_7_nts_x64.dll
to it.
This is the result:
$ php -v
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_pdo_sqlsrv_7_nts_x64.dll' - The specified procedure could not be found.
in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_sqlsrv_7_nts_x64.dll.dll' - The specified procedure could not be found.
in Unknown on line 0
PHP 7.1.6 (cli) (built: Jun 8 2017 01:53:41) ( ZTS MSVC14 (Visual C++ 2015) x64 )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
Probable duplicate of this: PHP Warning: PHP Startup: Unable to load dynamic library php_pdo_mssql.dll
But that one's never answered and four years old.
Upvotes: 6
Views: 22764
Reputation: 145
I tried this using PHP732 on windows server 2019 with IIS10 using the php_pdo_sqlsrv_73_nts_x64.dll, works just fine without issue. It gives warning if I enable 73_ts_x64.
Upvotes: 0
Reputation: 2444
In my case, this error (but with a different DLL version) was caused by adding the wrong PHP SQL SLQSRV DLL to my PHP extensions:
I am using PHP 7.2.21 from XAMPP.
I added these DLLs (included in SQLSRV561.exe):
I enabled php_pdo_sqlsrv_72_nts_x64.dll
as PHP extension, but the nts dll version was the wrong one for my PHP version. When I enabled the ts dll version, the error disappeared. ( I am using IIS.)
Thread Safe (TS) and Non-Thread Safe (NTS) are the two different PHP builds available.
Upvotes: 6
Reputation: 673
It's a good idea to look at the release information.
That way you can see what version it supports.
https://github.com/Microsoft/msphpsql/releases
In my case the mssql driver is still one minor version behind php's latest stable version, so I have to downgrade my php from 7.1 to 7.0.
Upvotes: 2
Reputation: 465
Is your PHP version thread-safe? You are using the library for this version, you can use "php -i|find "Thread"
from command line in windows.
Upvotes: 0