2
votes

I am running php 7.3 on my local machine running windows 10 and it works perfectly with the sqlsrv extension and ODBC Driver 17. I am trying to update php to 7.4 but php will not load the extension. Anyone know why it is not loading?

Error I get:

PHP Warning: PHP Startup: Unable to load dynamic library 'php_sqlsrv_74_nts_x64' (tried: C:\Program Files (x86)\PHP\v7.4\ext\php_sqlsrv_74_nts_x64 (The specified module could not be found.), C:\Program Files (x86)\PHP\v7.4\ext\php_php_sqlsrv_74_nts_x64.dll (The specified module could not be found.)) in Unknown on line 0

2
Where is the extension folder (what is the value for extension_dir key from <?php phpinfo();?> script execution)? Probably you need to change the extension folder in the php.ini configuration or set two paralel PHP installations on this PC.Zhorov
extension_dir = "C:\Program Files (x86)\PHP\v7.4\ext\" . The extensions dir is in the same directory as the ini file.Ben
Also, php_php_sqlsrv_74_nts_x64.dll is 64-bit version of the extension, while C:\Program Files (x86)\PHP\.. is probably 32-bit installation.Zhorov
I j8st checked Settings and confirmed that it IS 64 bit. I wanted you to be right! Any other ideas?Ben
PHP version, PHP Driver for SQL Server vesrion, ODBC Driver version must be all 64-bit (or 32-bit). If I remember correctly, you also need Microsoft Visula C++ redistributable.Zhorov

2 Answers

3
votes

Found a solution... You need to add the file extension to the extension= in the php.ini file.

php.ini config

So php.ini should look like this:

extension=php_pdo_sqlsrv_74_nts_x64.dll
extension=php_sqlsrv_74_nts_x64.dll
1
votes

You can write the complete filename in php.ini like that:

extension=php_pdo_sqlsrv_74_nts_x64.dll

But because this is supported only for legacy reasons I would recommed the format extension=<ext> without 'php_' and '.dll'. In your case:

extension=pdo_sqlsrv_74_nts_x64