2

I have installed:

  1. Windows Server 2008 R2 x64
  2. IIS 7
  3. PHP 5.5 (5.5.9) VC11 x64 Non Thread Safe (2014-Feb-06 00:36:15)
  4. MSVC11 (Visual C++ 2012)
  5. Sql Server 2008
  6. Sql Native Client

Everything works perfectly except the MSSQL driver for PHP. I have Googled a lot and downloaded lots of dll files. Every time I get this error:

PHP Warning: PHP Startup: Unable to load dynamic library c:\php\ext\php_sqlsrv_54_nts.dll - %1 is not a valid Win32 application. in Unknown on line 0

Can anyone tell me that how can I find the specified driver? Thanks in advance.

5
  • 1
    Are you using the 32 or 64 bit version of PHP? Commented Mar 4, 2014 at 19:27
  • I was editing it.It is 64 bit Commented Mar 4, 2014 at 19:28
  • 1
    Have you installed Native Client? Sqlsrv Requirements Commented Mar 4, 2014 at 19:36
  • I edited my post.I have installed it too. You can see the link where I got it from Commented Mar 4, 2014 at 19:43
  • 1
    possible duplicate of PHP 5.5.0 w/ Microsoft SQL Server 2008 R2 - No sqlsrv_connect()? Commented Jan 28, 2015 at 9:27

3 Answers 3

2

There's a clue in the file name php_sqlsrv_54_nts.dll

The "54" refers to PHP 5.4. The SQL Driver doesn't (officially) exist yet for PHP 5.5.

:(

Some people have worked on unofficial builds, but I would only use them for local testing. Microsoft sqlsrv extension for php 5.5.x

At present official releases only work with 5.4.x

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you all. I downgraded php to version 5.3 and fixed the problem
2

Here is a page from my blog with instructions on how to install the driver: http://robsphp.blogspot.com/2012/09/how-to-install-microsofts-sql-server.html

Look for text written in in orange which refers to my builds of the driver that support PHP 5.5 32 and 64 bit.

If you only want Microsoft's builds, avoid looking at anything written in orange.

Comments

0

Sharing some of my findings:

  1. Architecture matters(x86 / x64)
  2. PHP version matters a lot
  3. Matching SQL Driver Should be installed.
  4. Refer This Link to find whether your PHP version supports the driver (Refer the first table).
  5. Refer Rob's Answer to find your Architecture and TS/NTS (Thread Safe/Non Thread Safe) of Your PHP This is His Blog
  6. This is what worked out for me: I tried with Wampp - 64bit, Selected PHP 7.0.10 downloaded MYSQL Driver version 5.3 (Note: Refer the table i mentioned- 4th point to get the correct version)
  7. Saved only the 64 bit TS (php_sqlsrv_7_ts_x64.dll, php_pdo_sqlsrv_7_ts_x64.dll) because my php was Thread Safe (You can find yours by refering 5th point) into the E:\wamp64\bin\php\php7.0.10\ext folder.
  8. Added extension=php_sqlsrv_7_ts_x64.dll and extension=php_pdo_sqlsrv_7_ts_x64.dll to the php.ini, selected from wampp menu (E:\wamp64\bin\apache\apache2.4.23\bin\php.ini).
  9. Restarted Wampp, and it works perfect.
  10. For those who face call to undefined function sqlsrv_connect() also can follow this technique.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.