views:

21

answers:

2

Hello!

I have a PHP application currently connectig to a SQL Server via ODBC using Windows Authentication (odbc_connect).

Under Apache this works fine.

However I need to run this under PHP-IIS. While I can run PHP under IIS, and get this very same application connect to SQL Server when I run it from Apache, trying to run via IIS gives me the following problem:

PHP Warning:  odbc_connect() function.odbc-connect</a>: SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database "xxx_v2" requested by the login. The login failed., SQL state 37000 in SQLConnect 

I'm desperate and have been trying to do this for days. I will really appreciate you help!

I'm using php 5.2.6, IIS 7 and SQL Server 2008

A: 

Which php extension are you using for SQL Server interaction? Could do worse than read up on the moodle project's page about sql server and php - I found it useful. I've used FreeTDS without problems on Apache.. IIS however is a dead zone for me, sorry.

e: ah, ok.. ODBC connection. Not sure if that relates to my post, sorry. Could try a different connection method?

danp
A: 

Have you tried connecting with SQL Server authentication (username/password)? With Windows Authentication, the credentials that IIS is passing to SQL Server are not the same as the credentials that Apache is passing. The credentials that are passed depend on what authentication mechanism your site is using (if any). There is more detail about this (and suggested solutions) in this post: http://blogs.msdn.com/b/brian_swan/archive/2010/02/10/sql-server-driver-for-php-understanding-windows-authentication.aspx (this focuses on the SQLSRV driver, but I think the concepts apply regardless of the driver you are using).

Hope that helps.

-Brian

Brian Swan