Haohao Notes

DREAM OF TECHNICAL ACHIEVEMENT

0%

PHP MSSQL error code 0x2746 - SQLSTATE[08001]

在Linux下使用PHP连接SqlServer出现以下错误:

1
SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: Error code 0x2746

发现问题

https://github.com/microsoft/msphpsql/issues/1021

修复参考思路

https://wiki.debian.org/ContinuousIntegration/TriagingTips/openssl-1.1.1

解决方式

/etc/ssl/openssl.cnf配置CipherString改为DEFAULT@SECLEVEL=1

原配置

1
2
3
[system_default_sect]
MinProtocol = TLSv1.2
CipherString = DEFAULT@SECLEVEL=2

改后配置

1
2
3
[system_default_sect]
MinProtocol = TLSv1.2
CipherString = DEFAULT@SECLEVEL=1

通过命令解决

1
sed -i -E 's/(CipherString\s*=\s*DEFAULT@SECLEVEL=)2/\11/' /etc/ssl/openssl.cnf