Unable to load dynamic library php_sqlsrv_7_nts.dl

2020-02-13 14:27发布

问题:

Thought I'd see if there were any sql server drivers for php 7. Another question on Stack Overflow pointed me to these drivers here

So I install php_sqlsrv_7_nts.dll into my ext folder and add the following line to my php.ini:

extension=php_sqlsrv_7_nts.dll

I get this warning on every php script I run:

Warning: PHP Startup: Unable to load dynamic library 'C:\php7\ext\php_sqlsrv_7_nts.dll' - %1 is not a valid Win32 application

I realise this is just a pre-release version and there are many things to iron out still, but I was hoping to at least do some basic things.

What am I doing wrong, or do I need to wait a bit more for a better release.

Some info that might be useful:

PHP Version => 7.0.5

System => Windows NT GB275L-I-T-5654 6.3 build 9600 (Windows 8.1 Professional Edition) i586
Build Date => Mar 30 2016 09:57:56
Compiler => MSVC14 (Visual C++ 2015)
Architecture => x86
Configure Command => cscript /nologo configure.js  "--enable-snapshot-build" "--enable-debug-pack" "--disable-zts" "--with-pdo-oci=c:\php-sdk\oracle\x86\instantclient_12_1\sdk,shared" "--with-oci8-12c=c:\php-sdk\oracle\x86\instantclient_12_1\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--with-mcrypt=static" "--without-analyzer" "--with-pgo"

回答1:

Finally got this solved. Needed to install some more things before it would work, namely:

  1. Microsoft Visual C++ 2015 Redistributable (x86) which you can get from here

  2. The ODBC drivers which you can get from here



回答2:

It works for me.

1.Download the extension windows 7.0 https://github.com/Microsoft/msphpsql/releases

2.And then according to the system requirement paste it in ext folder. Note: Paste only the thread safe version (php_pdo_sqlsrv_7_ts.dll , php_sqlsrv_7_ts.dll)

3.And edit the php.ini file add this extension to your php.ini file and restart and check



标签: php-7