SQLSRV PHP for SQL Server for is not a valid Win32 application

大城市里の小女人 提交于 2020-01-22 07:13:34

问题


Here is my setup

  • Windows Server 2008 R2 64 bit
  • Apache 2.4.4 64 bit
  • PHP 5.4.15 32 bit (64 bit is still experimental), thread safe, VC9 compiler
  • Microsoft SQL Server 2012 Native Client 64-bit
  • Microsoft Visual C++ 2010 x86 and x64

I need to load Microsoft's SQLSRV library.

I have added 'extension=php_sqlsrv_54_ts.dll' to php.ini and copied 'php_sqlsrv_54_ts.dll' to the ext folder where PHP is installed.

When I restart apache, I get the following error in my php error log, and SQLSRV is not listed in phpinfo.

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

Where am I going wrong?

EDIT For testing purposes I've just installed PHP 5.5.10 64 bit and VC 2012 but the error remains the same :(


回答1:


I don't know if it helps but i used all 32bit on my Windows 7 64bit system

Here is what I used and i can use SQL Server

httpd-2.4.6-win32-VC9 //apache 2.4
php-5.4.9-Win32-VC9-x86 //php5

inside if my \php\ folder i have

  • php5apache2_4.dll

Inside \php\ext\ i have

  • php_pdo_sqlsrv_54_nts.dll
  • php_pdo_sqlsrv_54_ts.dll

I added this to the end of php.ini

[PHP_SQLSRV]
extension=php_sqlsrv_54_ts.dll
[PHP_PDO_SQLSRV]
extension=php_pdo_sqlsrv_54_ts.dll

I remember it being a right pain getting it to work but it does now. If i remember anymore i'll edit my answer

UPDATE:

I think this blog post looks familiar on how i got it working

http://robsphp.blogspot.co.uk/2012/09/how-to-install-microsofts-sql-server.html




回答2:


currently Microsoft sqldriver only works for 32bit php version. Here is my steps to install sql drivers.

  • install 32 bit wamp server below configuratoin Apache : 2.4.9 MySQL : 5.6.17 PHP : 5.5.12 PHPMyAdmin : 4.1.14 SqlBuddy : 1.3.3 XDebug : 2.2.5 installed http://www.microsoft.com/en-us/download/details.aspx?id=20098 3.2 drivers installed odbc driver.



回答3:


I had the same issue. Running a legacy 5.6 php x64 which needed the interface because of the hard RAM restrictions 32 bits give.

The solution was in the unoffical driver offered by Rob.

https://robsphp.blogspot.nl/2012/06/unofficial-microsoft-sql-server-driver.html

I tested it out, and it works properly with 5.6.33 x64




回答4:


Sqlsrv works with Non Thread Safe 32bit php with Sql Native client.



来源:https://stackoverflow.com/questions/22530231/sqlsrv-php-for-sql-server-for-is-not-a-valid-win32-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!