私はMSSql Dbを持っています。私のRedHatボックスでApacheを実行しているPHP7.1から接続しようとしています。私はsqlsrv & & pdo_sqlsrv拡張機能をインストールし、それらがphp.ini経由で存在することを確認しました。PHP経由でMS SQL Serverに接続できません
これは私が私の接続をテストするために使用しています小さなスクリプトです:
<?php
$serverName = "MY_IP_ADDRESS"; //serverName\instanceName
// Since UID and PWD are not specified in the $connectionInfo array,
// The connection will be attempted using Windows Authentication.
$connectionInfo = array("Database"=>"MY_DB", "UID"=>"MY_UID", "PWD"=>"MY_PWD");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if($conn) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die(print_r(sqlsrv_errors(), true));
}
?>
これは、私はこのスクリプトあちこちに取得していますREPONSEです:
Connection could not be established.
Array
(
[0] => Array
(
[0] => HYT00
[SQLSTATE] => HYT00
[1] => 0
[code] => 0
[2] => [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired
[message] => [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired
)
[1] => Array
(
[0] => 08001
[SQLSTATE] => 08001
[1] => 10013
[code] => 10013
[2] => [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]TCP Provider: Error code 0x271D
[message] => [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]TCP Provider: Error code 0x271D
)
[2] => Array
(
[0] => 08001
[SQLSTATE] => 08001
[1] => 10013
[code] => 10013
[2] => [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]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] => [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]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.
)
)
私は私ができるのtelnetで確認しました私のRedhatボックスからMSSqlサーバーに接続します。私がDBに接続できない理由についての手がかりは?
これは、必ずしも問題がMSSQLサーバー上にあることを意味するのでしょうか、それともクライアント側に問題が残る可能性がありますか? – bos570
このスクリプトは、コマンドラインまたはWebページから実行していますか? – miken32
@ miken32 Webページ – bos570