RHEL9 下连接老版本SqlServer的TCP Provider: Error code 0x2746问题

RHEL9 安装了 ODBCDriver 和php-sqlsrv模块,连接sqlserver2022没问题,但连接sqlserver2012和sqlserver2008均报错:

[0] => 08001
[SQLSTATE] => 08001
[1] => 10054
[code] => 10054
[2] => [Microsoft][ODBC Driver 18 for SQL Server]TCP Provider: Error code 0x2746
[message] => [Microsoft][ODBC Driver 18 for SQL Server]TCP Provider: Error code 0x2746

这是因为TLS版本不匹配。

在RHEL9上运行:
update-crypto-policies --set LEGACY

问题解决。

参考:
https://stackoverflow.com/questions/57265913/error-tcp-provider-error-code-0x2746-during-the-sql-setup-in-linux-through-te
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/security_hardening/using-the-system-wide-cryptographic-policies_security-hardening