title: PHP: Connect to MS SQL Server using Domain user and Password
body: <p>I have WAMP and am trying to connect to to my SQL Server 2008 database by entering a domain user and password using the following PHP command:</p>
  
  <pre><code>$serverName = "MySQLServer\Instance"; //serverName\instanceName
  $connectionInfo = array( "Database"=&gt;"dbName", 
                           "UID"=&gt;"myADUserName", "PWD"=&gt;"MyPassword");
  $conn = sqlsrv_connect( $serverName, $connectionInfo);
  </code></pre>
  
  <p>As I understand it, it is trying to authenticate with a SQL Server created user and not from the Active Directory, so I am getting the following error message:</p>
  
  <pre><code>Array ( [0] =&gt; 
     Array ( [0] =&gt; 28000 [SQLSTATE] =&gt; 28000 
             [1] =&gt; 18456 [code] =&gt; 18456 
             [2] =&gt; [Microsoft][SQL Server Native Client 10.0]
                    [SQL Server]Login failed for user 'myADUserName'. 
                    [message] =&gt; [Microsoft]
                        [SQL Server Native Client 10.0]
                        [SQL Server]Login failed for user 'myADUserName'.  
           ) 
          [1] =&gt; 
     Array ( [0] =&gt; 28000 [SQLSTATE] =&gt; 28000 
             [1] =&gt; 18456 [code] =&gt; 18456 
             [2] =&gt; [Microsoft][SQL Server Native Client 10.0]
                    [SQL Server]Login failed for user 'myADUserName'. 
                    [message] =&gt; [Microsoft]
                        [SQL Server Native Client 10.0]
                        [SQL Server]Login failed for user 'myADUserName'. 
           ) 
       )
  </code></pre>
  
  <p>Is this possible in PHP with WAMP?</p>
  
  <p>I've read about changing the log on account in the wampapache service to myADUserName, but the user doesn't have access administrator access on the server to allow this and I wouldn't want to tie one account to all my PHP applications.</p>