> 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"}}
I've been googling around for the last couple of days and couldn't find a solution.
I've tried:
- Changing the identity in the Application Pool
- IISreset
- Adding other user with less restricted permissions to PHP folder and the native client dlls
- Reinstalling PHP
- Reinstalling Native Client
Still getting the same error.
UPDATE
I installed SQLCMD tools and it connects correctly to the server.
SQLCMD -S tcp:SERVER,1433 -Q "select getdate()" I get a reply with todays date so it looks to be connecting correctly.
The DLL versions are
SQLNCLI10.DLL 2009.100.1600.1
SQLSRV32.DLL 2000.85.1117.0 (I Updated this one with the DLL from another server but still didn't help)
It is now Version 6.1.7600.16385
If I use odbc_connect it works, but why doesn't it work with sqlsrv_connect? Our developer tells me that it's better to use sqlsrv_connect because it works better with zend and bulk updates.
We can't upgrade server a because we have a number of legacy code running 32 bit services which wont run in WS2008 64bit
If we try this same script from the test server or localhost it works fine.
Are we missing something? We've been thourgh sqlsrv requirements and it's all there but can't reach the native client. If I create an odbc connection n control panel using Native Client there is no problem.
Also running static php pages work fine, so the problem is between sqlsrv and native client.
As it turned out, it was a permission issue. I'm using the application pool as Network Service. This user was getting access denied to the registry where tthe path to the Native Client is stored.
I downloaded Process Monitor and followed the instructions on this post
sl_fede
4 Posts
PHP 5.3 + IIS6.0 + Windows Server 2003 R2 SP2 not recognizing native client
Mar 23, 2012 04:11 PM|LINK
Hi Guys,
We have this setup
SERVER A
Windows Server 2003 R2 SP2 x86
IIS 6.0
PHP 5.3.10 VC9 TS
Microsoft Sql Drivers for PHP (sqlsrv) 2.0
Native Client 2008 R2 x86
SERVER B
Windows Server 2008 R2 x64
Microsoft SQL Server 2008 R2 x64
When using this script to connect from server A
I've been googling around for the last couple of days and couldn't find a solution.
I've tried:
- Changing the identity in the Application Pool
- IISreset
- Adding other user with less restricted permissions to PHP folder and the native client dlls
- Reinstalling PHP
- Reinstalling Native Client
Still getting the same error.
UPDATE
I installed SQLCMD tools and it connects correctly to the server.
SQLCMD -S tcp:SERVER,1433 -Q "select getdate()" I get a reply with todays date so it looks to be connecting correctly.
The DLL versions are
SQLNCLI10.DLL 2009.100.1600.1
SQLSRV32.DLL 2000.85.1117.0 (I Updated this one with the DLL from another server but still didn't help) It is now Version 6.1.7600.16385
If I use odbc_connect it works, but why doesn't it work with sqlsrv_connect? Our developer tells me that it's better to use sqlsrv_connect because it works better with zend and bulk updates.
We can't upgrade server a because we have a number of legacy code running 32 bit services which wont run in WS2008 64bit
If we try this same script from the test server or localhost it works fine.
Are we missing something? We've been thourgh sqlsrv requirements and it's all there but can't reach the native client. If I create an odbc connection n control panel using Native Client there is no problem.
Also running static php pages work fine, so the problem is between sqlsrv and native client.
Any help would be great!
Federico
PHP iis 6 SQL Error PHP 5 IIS6 installation sqlsrv sqlsrv_connect native client
sl_fede
4 Posts
Re: PHP 5.3 + IIS6.0 + Windows Server 2003 R2 SP2 not recognizing native client
Mar 29, 2012 08:33 AM|LINK
As it turned out, it was a permission issue. I'm using the application pool as Network Service. This user was getting access denied to the registry where tthe path to the Native Client is stored.
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!
Cheers,
Fede
Permissions Registry process