Reputation: 536
I am unable to connect to SQL Server 2008 R2 from my PHP v7.1.7 website running under IIS.
Basic PHP pages display ok - but nothing to do with sql server works. So the basic IIS site and PHP use are ok.
I have downloaded the SQL Server drivers drivers and configured them in the php.ini file
I am aware that the php 7.1 drivers are different to other php versions.
extensions directory (ext) has following DLLs added: php_pdo_sqlsrv_71_nts.dll php_sqlsrv_71_nts.dll
"C:\Program Files\PHP\v7.1\php.ini" has following extensions added:
[ExtensionList]
extension=php_sqlsrv_7_nts.dll
extension=php_pdo_sqlsrv_7_nts.dll
The PHP manager in IIS shows these extensions enabled.
On debugging I notice there is a basic problem loading these drivers in the error file PHP71x64_errors.log
i.e. [13-Mar-2018 00:51:27 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\v7.1\ext\php_sqlsrv_7_nts.dll' - The specified module could not be found. in Unknown on line 0 [13-Mar-2018 00:51:27 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\v7.1\ext\php_pdo_sqlsrv_7_nts.dll' - The specified module could not be found. in Unknown on line 0
The files do exist at those locations and I granted everyone full access - including IUSR the default user of the iis application pool used for the website.
Now the chat sites are full of this problem - no one seems to have a definitive answer. Most blogs point to yet another set of sql server drivers to try that do not work.
My questions are:
1) Should the thread safe (ts) or non thread safe (nts) version of the SQL Server drivers drivers be used with IIS on win 10? 2) I assume as win 10 is 64bit - the 64 bit version of the drivers should be used instead of the x86 ones - can someone confirm? 3) Can anyone point me to a definitive SQL Server 2008 R2 driver download that is GUARANTEED to work with my win 10 and IIS v10.0.16299.15 install?
Note: I have already downloaded the wp-db-abstraction must use PHP plugin for SQL Server and installed into the mu-plugins directory.
Upvotes: 1
Views: 279
Reputation: 536
The problem was the ODBC driver php_odbc.dll extension was disabled as viewed in PHP Manager on the website. Enabled it and everything worked fine.
Note: I actually wanted to use SQL Server instead of MySQL for wordpress but i see i'd have to use the projectnami wordpress download for that. (projectnami.org)
Upvotes: 1