Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PHP Windows Authentication SQL Server

Posted on 2009-07-07
6
Medium Priority
?
354 Views
Last Modified: 2013-12-13
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
Comment
Question by:MrBaseball9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 51

Accepted Solution

by:
Ted Bouskill earned 375 total points
ID: 24800538
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
 
LVL 22

Expert Comment

by:cj_1969
ID: 24803701
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
 

Author Comment

by:MrBaseball9
ID: 24804856
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
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
LVL 22

Expert Comment

by:cj_1969
ID: 24805824
0
 
LVL 22

Assisted Solution

by:cj_1969
cj_1969 earned 375 total points
ID: 24805846
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
 

Author Comment

by:MrBaseball9
ID: 24850180
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

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question