Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 370
  • Last Modified:

PHP Windows Authentication SQL Server

I created a program and tested it under a php/mysql platform. I now need to alter my code to use Windows Authentication to connect to a SQL server database. Due to the server configuration, I cannot use mixed mode. I read somewhere that if I create the same usernames on both servers that i could trick the authentication. Could anyone supply me with some example connection strings that I could use to connect to an SQL server with Windows Authentication?
0
MrBaseball9
Asked:
MrBaseball9
  • 3
  • 2
2 Solutions
 
Ted BouskillSenior Software DeveloperCommented:
You cannot trick NTLM authentication.  If PHP is running in IIS it is running in an application pool.   If you use a domain account in the identity of the application pool then use integrated security in the data connection that domain account is used to connect to SQL.  It's a very safe secure way to have a web application communicate with SQL.
0
 
cj_1969Commented:
To add to what tedbilly said, and to I believe address your question ...
If you create identical accounts on both servers and give them the same password then you can use this account on the application pool and use integrated security in the data connection AND grant the account on the SQL server permissions to the database then this should work.
0
 
MrBaseball9Author Commented:
OK, that sounds like what I was reading about.

Is there anything specific about the connection strings for this to happen?
Does anyone have a example that I can mimic?
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
cj_1969Commented:
If you are using a php driver then you might be stuck providing credentials for the connection string.
If you can use the examples I provided within php great, otherwise try creating a system DSN and configure it to use Windows authentication.  Hopefully this will use the app pool identity when the php script runs to authenticate the connection to the database.
0
 
MrBaseball9Author Commented:
I followed the follorwing tutorial and have managed to connect successfully.

http://msdn.microsoft.com/en-us/library/cc296205(SQL.90).aspx
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now