2

I'm looking for solution for 2 days already. I'm getting following effect:

   array(2) {
  [0] => array(6) {
    [0] => string(5) "IMSSP"
    ["SQLSTATE"] => string(5) "IMSSP"
    [1] => int(-49)
    ["code"] => int(-49)
    [2] => string(390) "This extension requires either the Microsoft SQL Server 2008 Native Client (SP1 or later) or the Microsoft SQL Server 2008 R2 Native Client ODBC Driver to communicate with SQL Server.  Neither of those ODBC Drivers are currently installed. Access the following URL to download the Microsoft SQL Server 2008 R2 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712"
    ["message"] => string(390) "This extension requires either the Microsoft SQL Server 2008 Native Client (SP1 or later) or the Microsoft SQL Server 2008 R2 Native Client ODBC Driver to communicate with SQL Server.  Neither of those ODBC Drivers are currently installed. Access the following URL to download the Microsoft SQL Server 2008 R2 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712"
  }
  [1] => array(6) {
    [0] => string(5) "IM002"
    ["SQLSTATE"] => string(5) "IM002"
    [1] => int(0)
    ["code"] => int(0)
    [2] => string(91) "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
    ["message"] => string(91) "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
  }
}

Looks like there's no "Microsoft SQL Server 2008 R2 Native Client" but there is!

I've already used same configuration on my local machine and test server. I was getting same error on local machine when there was no "Microsoft SQL Server 2008 R2 Native Client" installed. After installing it the problem was solved.

Unfortunatelly here I can't see any change.

I was trying different PHP and sqlsrv drivers but that had no effect.

I can't experinemt a lot because this is live server.

How can I make this working? Is this have something to do with control panel ODBC settings? There's also another native client installed but I can't remove it from this live server.

How to read this information? Does php sqlsrv driver sees native client at all?

Edit

The problem is that I'm using everything in 32 bit. Native driver is also shown in ODBC control panel. Sqlsrv extension for PHP is also working as shown in phpinfo.

How is that possible that sqlsrv extension for PHP doesn't "see" that native client?

I'm powerless and now I'm setting up VM where I'll set exactly the same cofiguration as on web server and will make some bolder experiments.

dandan78
  • 13,328
  • 13
  • 64
  • 78
Pawel
  • 16,093
  • 5
  • 70
  • 73
  • If you're on a 64bit Windows host, remember that there'll be both a 32bit and 64bit ODBC control panel, with different drivers. If your PHP is 32bit, and you've only got the 64bit R2 driver, then it'll appear to PHP that there is no driver. – Marc B Apr 28 '11 at 15:10
  • You need to install **all** the drivers from 1 of these packs : **[Driver pack for x86](http://go.microsoft.com/fwlink/?LinkID=188400&clcid=0x409)** (32-bit). OR **[Driver pack for x64](http://go.microsoft.com/fwlink/?LinkID=188401&clcid=0x409)** (64-bit). –  Jul 22 '13 at 07:50
  • Which version of the sqlsrv PHP extension are you using? i.e. what is the name of the `PHP/ext/php_sqlsrv_xxx.dll` file? – icc97 Jul 23 '13 at 09:16

2 Answers2

2

Install 32 and 64 bit drivers on the server. The 32 bit odbc control panel is located in the Windows\SysWow64 directory - not totally obvious, but that's it. Make sure you have drivers for your executable (PHP) - if it's 32 bit, you need 32 bit drivers.

Sam
  • 7,543
  • 7
  • 48
  • 62
  • The problem is that I'm using everyting in 32 bit. Native driver is also shown in ODBC control panel. Sqlsrv extension for PHP is also working as shown in phpinfo. How is that possible that sqlsrv extension for PHP doesn't "see" that native client? I'm powerless and now I'm setting up VM where I'll set exactly the same cofiguration as on web server and will make some bolder experiments. –  May 03 '11 at 14:33
  • What about this error? [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified . Did you create a DSN for whatever you are attempting to do? Perhaps you could explain your situation a little more. – Sam May 04 '11 at 21:58
  • now I know it's something about permissions, there was some problem with internet users on this server in past and now there are 2 internet users maybe that's a problem – Pawel May 10 '11 at 11:02
  • Check the SQL logs to see if you're getting errors there, but I would doubt it, seems like you're having issues on a level lower than that. – Sam May 10 '11 at 21:11
1

It seems that you are having the same issue as I was having this week

I downloaded Process Monitor and followed the instructions on this post

http://www.iislogs.com/articles/processmonitorw3wp/

Then I saw the process w3wp.exe was getting access denied on this registry key

HKLM\Software\ODBC\ODBCINST.INI\SQL Native Client 10.0

I opened RegEdit and went to that key.

I did right click - > Permissions and added Network Service to the list and gave it Read permissions.

Recycled the app pool and it is now working!

Hope it helps.

Cheers, Fede

Federico Giust
  • 1,803
  • 4
  • 20
  • 45