Error: "PHP Startup: sqlsrv: Unable to initialize module"

Asked

Viewed 1,937 times

4

I’m trying to access SQL Server through XAMPP on Windows 7 64 bits, but I’m not getting, I already followed step by step the tutorials, but when starting Apache gives the error in the line below:

Line that gives the error

extension=php_sqlsrv_54_ts.dll

Error message.

[31-Oct-2014 11:12:29 UTC] PHP Warning: PHP Startup: sqlsrv: Unable to initialize module Module Compiled with module API=20100525 PHP
Compiled with module API=20121212 These options need to match in Unknown on line 0

  • @bigown believed that the old title was more descriptive. By default php did not include the dlls for connection to SQL Server.

  • @gmsantos is not easy to find a good title for this "question". But the previous title does not describe any question, doubt or problem. It essentially says which technologies are used, which is a function of tags. In fact, I’m missing a piece of information.

  • 1

    @Alexander, what step by step you have followed ?

  • 3

    Title I suggest: php startup sqlsrv unable to initialize module

  • 1

    In the phpinfo() the item Thread Safety is as?

  • 2

    The API=20121212 corresponds to PHP 5.5. The error you have is because you tried to install the extension sqlsrv for a version of PHP that is not the one you have installed...

  • 1

    Which version of Xampp and php ?

  • 1

    @gmsantos PHP version is PHP Version 5.3.3-7+squeeze19 Xampp version is 1.8.3-5-VC11

  • Thread Safety enabled

  • possible duplicate of Pdo drivers for sql server

Show 5 more comments

2 answers

4

Xammp does not keep track of the Dlls needed to connect to SQL Server, you need to manually download and copy to your PHP extensions folder.

You can download the latest versions of driver here.

This file is a self-extractor that will extract the Dlls to the directory you choose.

Once done, you need to choose the proper DLL and copy to the folder ext of PHP. This MSDN page indicates which DLL you should use according to the PHP version.

XAMPP comes with the version Thread Safety (TS) from PHP. Copy to directory xampp\php\ext a dll php_sqlsrv_XX_ts.dll, where XX matches your PHP version. Finally, in the configuration file include the line referring to DLL.

extension=php_sqlsrv_XX_ts.dll

Or if you want to use SQL Server with PDO:

extension=php_pdo_sqlsrv_XX_ts.dll

Obs.: The latest official version of drivers SQL Server supports up to PHP 5.4.

If you are using PHP 5.5 or higher, you can turn to a built unofficial while Microsoft does not release the new official version and vote to prioritize the launch of the official compatible version.

Update: The driver official has been updated and supports up to the latest stable version of PHP (5.6)

  • The problem is what you said, the compatibility of PHP .

  • I followed these steps now am doing http://robsphp.blogspot.co.uk/2012/06/unofficial-microsoft-sql-server-driver.html

  • @Alessandro only one point, even though the system is x64, use the 32-bit dll. A dll must be compatible with php, which in case is 32 btis

0

  • 1

    Decided to regress to php 5.4 ? Here in the service we have a server 5.5 in production with this unofficial dll, until today we had no problem.

  • But I couldn’t connect or regressing. heheheheh

Browser other questions tagged

You are not signed in. Login or sign up in order to post.