php pdo 连接 mssql 超时 是怎么回事啊?
Fatal error: Maximum execution time of 30 seconds exceeded in D:\PC_webserver\phproot\test.php on line 35

解决方案 »

  1.   

    $dsn = 'mssql:dbname=bookStore_demo;host=192.168.1.106';
    $user = 'sa';
    $password = '123';
    //mssql_connect('192.168.1.106','sa','123');
    //echo 22;
    try {
       // echo 11;
        $dbh = new PDO($dsn, $user, $password);} catch (PDOException $e) {
        echo 'Connection failed: ' . $e->getMessage();
    }
    //$sql = 'select * from article';
    $sth = $dbh->query($sql);
    $result = $sth->fetchAll();var_dump($result);
      

  2.   

    设置了 pdo 报这个错误Connection failed: SQLSTATE[01002] Unable to connect: SQL Server is unavailable or does not exist. Specified SQL server not found. (severity 9)mssql_connect Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: 192.168.1.106,1433 in D:\PC_webserver\phproot\API_M\test.php on line 8
    Couldn't connect to SQL Server on 192.168.1.106,1433