PHP not loading sqlsrv extension
The first problem, which I haven't solved yet is my php error log isn't showing extension loading issues unless I change the log file name. After changing the log file name I received the following error:
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\v7.1\ext\php_pdo_sqlsrv_7_nts_x64.dll' - The specified procedure could not be found.
As it turns out I needed to use the driver specific to PHP 7.1. I'm not sure why, by my original download didn't include the 7.1 drivers. Perhaps I mistakenly downloaded the sqlsrv 4.0 driver my first time around. I went and downloaded the sqlsrv 4.3 driver here:
https://www.microsoft.com/en-us/download/details.aspx?id=55642
I added the following to my php.ini
extension=php_sqlsrv_71_nts_x64.dll
extension=php_pdo_sqlsrv_71_nts_x64.dl
sqlsrv extenion is loaded now. I hope this helps someone else.
Related videos on Youtube
chump
One Man IT band for the more than the last decade. Jack of all trades master of none.
Updated on September 18, 2022Comments
-
chump over 1 year
I'm having trouble getting PHP to use Microsoft's
sqlsrv
extension on 64bit Windows server 2012 R2 running IIS and PHP 7.1.7. When I runphpinfo()
I don't see that the extension has been loaded. I'm assuming I should be looking forsqlsrv
as the the extension name. There is also no error in the PHP error log of any sort of failure loading the extension.I downloaded version 4.3 of the Microsoft's drivers which state they are compatible with PHP 7.1. I have copied the dll files into the
PHP\v7.1\ext
directory. I added the following lines to the php.ini file.extension=php_sqlsrv_7_nts_x64.dll extension=php_pdo_sqlsrv_7_nts_x64.dll
I have verified that my php.ini file is being read by intentionally misspelling one of the dll names and seeing a corresponding error in the php log.
SQL Server Native Client 10 and 11 is installed.
I have recycled the application pool, restarted the W3SVC service, and restarted the server.
I'm hoping someone here can offer some other things to try.
-
chump over 6 yearsFor some reason the error log was not showing any errors when trying to load the extension. I changed the log file name and found the following error. [29-Nov-2017 16:22:20 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\v7.1\ext\php_sqlsrv_7_nts_x64.dll' - The specified procedure could not be found. in Unknown on line 0
-
Patrick Mevzek over 6 yearsAdd your new info directly in your question instead of a comment.
-