Comments (12)
On 2013-10-09 01:32:17 UTC, jfha73 commented:
Just to clarify, the message is not "access denied" it is "login failed for user DOMAIN\USER"
from msphpsql.
On 2013-10-22 23:44:32 UTC, icosahedron commented:
Interesting. Can you show the exact PHP line? I'm wondering if it might require double backslashes?
Jay
from msphpsql.
On 2013-10-22 23:44:53 UTC, icosahedron commented:
Also, can you connect to the database from SSMS or sqlcmd?
from msphpsql.
On 2013-10-23 03:44:28 UTC, jfha73 commented:
This is what I have to test connection:
$_POST['dbName'], "UID"=>$_POST['username'], "PWD"=>$_POST['password'] ); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn ) { echo "Connection established.
"; sqlsrv_close( $conn ); }else{ echo "Connection could not be established.
"; die( print_r( sqlsrv_errors(), true)); } ?>I will try with double "" and I can connect just fine using any other way to connect.
from msphpsql.
On 2013-10-23 03:45:38 UTC, jfha73 commented:
I forgot to say it gets the variables from a form.
from msphpsql.
On 2013-10-23 03:47:39 UTC, jfha73 commented:
I tried using DOMAIN\User and I get same error.
from msphpsql.
On 2013-10-23 03:49:47 UTC, jfha73 commented:
DOMAIN\User (double backslash)
from msphpsql.
On 2013-10-23 03:50:25 UTC, jfha73 commented:
weird, I put double backslash on this forum and it shows 1
from msphpsql.
On 2013-10-23 16:07:43 UTC, robertjohnson commented:
You cannot log-in with Windows authentication using a UID and PWD. The UID and PWD are for
SQL Server credentials. Windows authentication is trusted, you don't send the UID - it gets it from your session. That's what it is.
With PHP, the Windows ID comes from the PHP instance. Why not check the forum where this has been discussed several times.
from msphpsql.
On 2013-10-24 07:16:09 UTC, jfha73 commented:
Doesn't that depend on what Browser and Server you use?
I know Windows Authentication can be used using IIS and IE, but in my case I use Apache and Firefox, does that apply in my case?
Thanks.
from msphpsql.
On 2013-10-24 07:23:35 UTC, jfha73 commented:
Also, how about if I want to login as another user? for example, I have 2 accounts, one that's a regular user with no admin rights to anything but my computer and a second one that has admin rights for everything in the domain, I am at my computer logged
in with my regular user account and I want to login using SQLSRV with my admin account?
It just doesn't make sense to me.
from msphpsql.
On 2013-10-24 15:34:25 UTC, robertjohnson commented:
PHP will use the credentials that Apache starts with for trusted login. So when you call sqlsrv_connect without a UID and PWD, the connection will be attempted with most likely your computer's system account.
You could either:
add a Windows login on SQL Server for the computer's system account that Apache is starting as.
set the start-up account for Apache to the same account that has access to SQL Server.
To be honest with you I think SQL Server credentials are the better route with PHP, then you can set up as many different accounts as you want and not have login issues when you deploy to different computers.
It does make perfect sense - with trusted login there is no password exchange, which would weaken the whole process of logging in. It just isn't suited to server side processes that may need to impersonate different accounts, but don't have a built-in/secure
way to do that *.
(* if you were an experienced Windows developer you could make a COM class that impersonates another Windows user - any SQL connections you make while impersonating will use the impersonated credentials, and stay that way even after you stop impersonating -
so to connect as a different Windows user, you: impersonate... connect with trusted login... stop impersonating... use your connection. However, it defeats the purpose of trusted login, and is not very different to using SQL Server credentials).
from msphpsql.
Related Issues (20)
- CentOS9 SQL Server 2014 connect failed. Microsoft ODBC Driver 18 for SQL Server : TCP Provider: Error code 0x2746. HOT 6
- Cakephp2 Application takes longer time to fetch data from sql server database resulting php memory error HOT 3
- Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server HOT 1
- Memory leak in Microsoft ODBC Driver 17.10.5 for SQL Server HOT 4
- HY104 Invalid precision value when reusing prepared statement HOT 4
- SQLSTATE[01002] Adaptive Server connection failed (xxx.xx.xx.xxx) HOT 1
- Issue connecting to SQL server from Openshift HOT 1
- Unable to build version 5.12.0beta1 on Windows HOT 2
- New attribute for sql bigint and decimal/numeric types to php int and float types HOT 1
- Performance problem when using params on select query HOT 2
- Error on both ARM64 and AMD64 docker build HOT 1
- apt fails to install from pmc-geofence.trafficmanager.net: 403 Forbidden HOT 10
- Error requesting access token while Azure webapps (php) connect to Azure SQL server by UMI HOT 4
- Windows DLL available to download HOT 1
- unable to install in ubuntu 22.04 container HOT 1
- SQL server connection HOT 8
- When will there be support for installing Ubuntu 24.04? HOT 1
- Error OpenSSL Shutdown while in init - cURL - MSSQL HOT 6
- SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [error:0A0C0103:SSL routines::internal error] HOT 4
- sqlsrv_connect does not try to establish a connection when there is no instance specified HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from msphpsql.