简体   繁体   English

SQLSRV PDO与域的连接

[英]SQLSRV PDO connection with domain

I have a problem when I try to connect with SQLSRV PDO with a server and user en domain. 当我尝试通过服务器和用户域与SQLSRV PDO连接时出现问题。 I put like this: 我这样写:

<?php
try{
    $conn = new PDO("sqlsrv:Server=instsql.domain\\instsql;Database=DatabaseName", "user@instsql.domain", "userpass");
}catch (PDOException $e){
    echo $e->getMessage();
    die();
} 

But when I test it, the browser send me this error: 但是,当我对其进行测试时,浏览器会向我发送此错误:

SQLSTATE[28000]: [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'user@instsql.domain'. SQLSTATE [28000]:用户'user@instsql.domain'的登录失败[Microsoft] [SQL Server本机客户端11.0] [SQL Server]。

The user is in the Active Directory, is the first time that I use SQLSRV PDO with domain users, I hope you can help me. 该用户位于Active Directory中,这是我第一次对域用户使用SQLSRV PDO,希望您能对我有所帮助。

the answer is that you need to stop the apache service, go to properties and in the section of start session, add your user and password. 答案是,您需要停止apache服务,转到属性,然后在启动会话部分中,添加用户和密码。 Start apache services and you connect SQL Server with the domain user. 启动apache服务,然后将SQL Server与域用户连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM