title: How to access remote SQL Server from PHP script
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/9986804/php-fatal-error-call-to-undefined-function-mssql-connect">PHP Fatal error: Call to undefined function mssql_connect()</a>  </p>
  </blockquote>
  
  
  
  <p>I am developing a light-weight PHP application which accesses a remote SQL server db.</p>
  
  <p>So far, I am out of luck in getting connection setup to SQL Server db through my PHP script.</p>
  
  <p>I keep getting this error when I am trying to connect to sql DB:</p>
  
  <pre><code>Fatal error: Call to undefined function mssql_connect()
  </code></pre>
  
  <p>I get similar error when I try <code>sqlsrv_connect($myServer, $myUser, $myPass)</code> too</p>
  
  <p><strong>Here is what I have already tried:</strong></p>
  
  <p>I search for solution on web for hours, but nothing works.</p>
  
  <p>I downloaded drivers from <a href="http://www.microsoft.com/en-us/download/details.aspx?id=20098" rel="nofollow noreferrer">http://www.microsoft.com/en-us/download/details.aspx?id=20098</a>
  and unzipped them into php/ext folder</p>
  
  <p>modified php.ini to add newly downloaded drivers lines:</p>
  
  <pre><code>extension=php_sqlsrv_54_ts.dll
  extension=php_pdo_sqlsrv_54_ts.dll
  
  [sqlsrv]
  sqlsrv.LogSubsystems = 1
  sqlsrv.LogSeverity = 1
  sqlsrv.WarningReturnAsErrors = 0
  </code></pre>
  
  <p>Restarted the Apache server</p>
  
  <p>But, <strong>see phpinfo() output it doesn't have sqlserv in it</strong> <a href="http://bit.ly/TkMC6V" rel="nofollow noreferrer">http://bit.ly/TkMC6V</a></p>
  
  <p>Just so you know, I am developing this on my windows machine by installing EasyPHP. This website will be deployed on a Unix box. I tried to connect sql server through php on both Windows and Unix machine without any success.</p>
  
  <p>Version info:</p>
  
  <pre><code>SQL Server 9.0.5000    
  PHP ver 5.4.6    
  Apache 2.4
  </code></pre>
  
  <p>I just dont get sqlsrv in my phpinfo() as mentioned in this question <a href="https://stackoverflow.com/questions/9986804/php-fatal-error-call-to-undefined-function-mssql-connect">PHP Fatal error: Call to undefined function mssql_connect()</a></p>
  
  <p>Is there a different way to install the drivers, other than what I have outlined above?</p>
  
  <p>Let me know if you need more info.
  Thanks!</p>