“找不到驱动程序"与MSSQL服务器一起使用PDO时出错 [英] "could not find driver" error when using PDO with MSSQL server
问题描述
这个问题已经问了很多遍了,我已经遍历了所有问题,但没有一个解决方案对我有用.
This question has been asked many times and I've gone through all of them and none of the solutions have worked for me.
基本上
使用PDO连接到MSSQL服务器时,出现找不到驱动程序"异常.以下是我的规格:
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:
- 从 * sqlsrv ts **.dll,因为我使用的是线程安全版本的PHP)
- 在php.ini中启用了它们(我知道wampserver中有两个php.ini文件,我已经在正确的php.ini中对其进行了编辑)
- 重新启动wampserver
- 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?
phpinfo()的输出;
Output of phpinfo();
在Apache的错误日志中找到以下内容:
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
推荐答案
对于遇到上述问题的人,这里是解决方案.
For those who run into the above problem here's the solution.
显然,Microsoft没有64位版本的SQLSRV驱动程序.切换到32位版本的wampserver解决了该问题.
Apparently Microsoft don't have a 64 bit version of SQLSRV driver. Switching to a 32 bit version of wampserver solved the problem.
这篇关于“找不到驱动程序"与MSSQL服务器一起使用PDO时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!