Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP connecting to SQL Server on localhost returns Error Locating Server/Instance Specified
    primarykey
    data
    text
    <p>EDIT: Sorry, I figured out what the problem was. I was editing the wrong file.</p> <p>I'm (trying) to use PHP 5.3.5 to connect to my SQL SERVER 2005 but it has been nothing but trouble. On the local machine, if I use <code>SQLCMD -S (local) -U sqlUser -P 1234 -d MyTable</code> it connects fine. But the following code produces an error:</p> <pre><code>&lt;?php $myServer = "(local)"; $myUser = "sqlUser"; $myPass = "1234"; $myDB = "MyTable"; $connectionInfo = array("Database"=&gt; $myDB, "UID" =&gt; $myUser, "PWD" =&gt; $myPass); //connection to the database try{ $dbhandle = sqlsrv_connect($myServer, $connectionInfo) or die(print_r( sqlsrv_errors(), true)); }catch(Exception $e){ echo "&lt;pre&gt;"; print_r($e); echo "&lt;/pre&gt;"; die; } ?&gt; </code></pre> <p>How can I get php to connect to my SQL Server?</p> <p>Full Error:</p> <hr> <pre><code>Array ( [0] =&gt; Array ( [0] =&gt; 08001 [SQLSTATE] =&gt; 08001 [1] =&gt; -1 [code] =&gt; -1 [2] =&gt; [Microsoft][SQL Server Native Client 10.0]SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF]. [message] =&gt; [Microsoft][SQL Server Native Client 10.0]SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF]. ) [1] =&gt; Array ( [0] =&gt; HYT00 [SQLSTATE] =&gt; HYT00 [1] =&gt; 0 [code] =&gt; 0 [2] =&gt; [Microsoft][SQL Server Native Client 10.0]Login timeout expired [message] =&gt; [Microsoft][SQL Server Native Client 10.0]Login timeout expired ) [2] =&gt; Array ( [0] =&gt; 08001 [SQLSTATE] =&gt; 08001 [1] =&gt; -1 [code] =&gt; -1 [2] =&gt; [Microsoft][SQL Server Native Client 10.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. [message] =&gt; [Microsoft][SQL Server Native Client 10.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. ) ) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload