2012-06-27 3 views
0

저는 PHP 및 SQL Server 2005와의 연결 문제를 끊임없이 조사하고 아직 행운을 찾지 않았습니다. SQL Server 2005 Standard Edition을 사용하고 있습니다.PHP SQL Server 2005 Standard Edition 연결 시간 초과

$server = "MYLAP01\\SQLEXPRESS"; 
$options = array("Database" => "test1"); 
$conn = sqlsrv_connect($server, $options); 

if ($conn === false) die("<pre>".print_r(sqlsrv_errors(), true));echo "Successfully connected!"; 

sqlsrv_close($conn); 

그리고 출력 :

Array 
(
    [0] => Array 
     (
      [0] => 08001 
      [SQLSTATE] => 08001 
      [1] => -1 
      [code] => -1 
      [2] => [Microsoft][SQL Server Native Client 11.0]SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF]. 
      [message] => [Microsoft][SQL Server Native Client 11.0]SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF]. 
     ) 

    [1] => Array 
     (
      [0] => HYT00 
      [SQLSTATE] => HYT00 
      [1] => 0 
      [code] => 0 
      [2] => [Microsoft][SQL Server Native Client 11.0]Login timeout expired 
      [message] => [Microsoft][SQL Server Native Client 11.0]Login timeout expired 
     ) 

    [2] => Array 
     (
      [0] => 08001 
      [SQLSTATE] => 08001 
      [1] => -1 
      [code] => -1 
      [2] => [Microsoft][SQL Server Native Client 11.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] => [Microsoft][SQL Server Native Client 11.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. 
     ) 

) 
+0

포트 번호를 추가하여이 문제를 해결했습니다. $ server = "MYLAP01 \\ SQLEXPRESS, 1433"; – jakedemus

+0

아래 답변에 솔루션을 넣고 동의해야합니다. –

답변

0

이 고정 포트 번호를 추가하여 :
다음 코드의 $ 서버 = "MYLAP01 \ SQLEXPRESS, 1433";

관련 문제