从 Centos7 到 mssql 的连接错误
Connection error to mssql from Centos7
我用 nginx/php5.6 安装了 Centos7。 MS SQL 2008 R2 正在另一台服务器上运行。
MSSQL 肯定允许 tcp 连接、自定义(非域)用户、禁用防火墙,我可以使用 HeidiSQL 和另一台 Windows 机器的设置连接到它。
我可以从 Centos 远程登录到 MSSQL(我在 MSSQL 日志中看到 Log error "Length specified in network packet payload did not match number of bytes read; the connection has been closed. Please contact the vendor of the client library." with centos ip address,所以这里没有错误)。
我无法使用 php_mssql 或 sqlcmd 从 centos 连接到 mssql;
在 sqlcmd 期间:
Microsoft (R) SQL Server Command Line Tool
Version 13.1.0007.0 Linux
[root@***]# /opt/mssql-tools/bin/sqlcmd -S *** -U ***
Password:
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : TCP Provider: Timeout error [258]. .
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Unable to complete login process due to delay in prelogin response.
在 php 互动期间:
php > mssql_connect('***:***', '***','***');
PHP Warning: mssql_connect(): Unable to connect to server: *** in php shell code on line 1
我也试过了tsql/freetds:
/etc/freetds.conf has section
[myserver]
host = ***
port = ***
client charset = UTF-8
tds version = 8.0 //also tried 7
[root@*]# tsql -S myserver -U ***
Password:
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
5 //begins to count, i could't understand what does it mean
还尝试全部清理并安装带有 sqlsrv 扩展名的 php7.0 - 同样的问题;
有一些网络异常 - Centos serv 和 MSSQL 在不同的网络中,我无法从该服务器 ping mssql,但可以 telnet,我在尝试连接时使用的是 ip,而不是主机名,所以不要觉得这有什么大不了的。
现在我不知道去哪里挖掘,有什么建议吗?
是网络配置错误造成的,我不太明白怎么可能- 建立telnet 连接,但无法正常连接,但我们的IT 人员在不到半小时内修复了这个问题。
我用 nginx/php5.6 安装了 Centos7。 MS SQL 2008 R2 正在另一台服务器上运行。 MSSQL 肯定允许 tcp 连接、自定义(非域)用户、禁用防火墙,我可以使用 HeidiSQL 和另一台 Windows 机器的设置连接到它。 我可以从 Centos 远程登录到 MSSQL(我在 MSSQL 日志中看到 Log error "Length specified in network packet payload did not match number of bytes read; the connection has been closed. Please contact the vendor of the client library." with centos ip address,所以这里没有错误)。
我无法使用 php_mssql 或 sqlcmd 从 centos 连接到 mssql;
在 sqlcmd 期间:
Microsoft (R) SQL Server Command Line Tool
Version 13.1.0007.0 Linux
[root@***]# /opt/mssql-tools/bin/sqlcmd -S *** -U ***
Password:
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : TCP Provider: Timeout error [258]. .
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Unable to complete login process due to delay in prelogin response.
在 php 互动期间:
php > mssql_connect('***:***', '***','***');
PHP Warning: mssql_connect(): Unable to connect to server: *** in php shell code on line 1
我也试过了tsql/freetds:
/etc/freetds.conf has section
[myserver]
host = ***
port = ***
client charset = UTF-8
tds version = 8.0 //also tried 7
[root@*]# tsql -S myserver -U ***
Password:
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
5 //begins to count, i could't understand what does it mean
还尝试全部清理并安装带有 sqlsrv 扩展名的 php7.0 - 同样的问题;
有一些网络异常 - Centos serv 和 MSSQL 在不同的网络中,我无法从该服务器 ping mssql,但可以 telnet,我在尝试连接时使用的是 ip,而不是主机名,所以不要觉得这有什么大不了的。
现在我不知道去哪里挖掘,有什么建议吗?
是网络配置错误造成的,我不太明白怎么可能- 建立telnet 连接,但无法正常连接,但我们的IT 人员在不到半小时内修复了这个问题。