This question has been asked many times and I've gone through all of them and none of the solutions have worked for me.
Basically,
I am getting "could not find driver" exception when connecting to MSSQL server using PDO. Below is my spec:
Windows 8 - 64 Bit version
MSSQL server 2008 R2 - 64 bit version
Wampserver 2.4 - 64 bit version with PHP 5.4 (Thread Safe version)
This what I have done so far:
- Downloaded SQLSRV – version 3.0 from here
- Placed the "php_pdo_sqlsrv_54_ts.dll" and "php_sqlsrv_54_ts.dll" files in "c:/wamp/bin/php/php.x.x/ext" directory (have used php_*sqlsrvts**.dll because I am using thread safe version of PHP)
- Enabled them in php.ini ( I know there are two php.ini files in wampserver and I have edited this in the correct php.ini )
- Restarted wampserver
But still I am getting the same error.
Can anyone please help me resolve this error?
Output of phpinfo();
Found following in the error logs of Apache:
PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.4.12/ext/php_pdo_sqlsrv_54_ts.dll' - %1 is not a valid Win32 application.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.4.12/ext/php_sqlsrv_54_ts.dll' - %1 is not a valid Win32 application.\r\n in Unknown on line 0
Best Answer
For those who run into the above problem here's the solution.
Apparently Microsoft don't have a 64 bit version of SQLSRV driver. Switching to a 32 bit version of wampserver solved the problem.