php sqlsrv 错误 TCP 提供程序:错误代码 0x271D

php sqlsrv 错误 TCP 提供程序:错误代码 0x271D

当我从浏览器 sqlsrv mssql 连接运行 php 脚本时。

但是当我通过 ssh 执行 php 脚本时

命令“/opt/alt/php-fpm70/usr/bin/php 路径/to/script.php”

sqlsrv_connect 给出此错误:

Array
(
[0] => Array
(
     [0] => HYT00
     [SQLSTATE] => HYT00
     [1] => 0
     [code] => 0
     [2] => [Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired
     [message] => [Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired
)

[1] => Array
    (
        [0] => 08001
        [SQLSTATE] => 08001
        [1] => 10013
        [code] => 10013
        [2] => [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: Error code 0x271D
        [message] => [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: Error code 0x271D
    )

[2] => Array
    (
        [0] => 08001
        [SQLSTATE] => 08001
        [1] => 10013
        [code] => 10013
        [2] => [Microsoft][ODBC Driver 17 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] => [Microsoft][ODBC Driver 17 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.
    )
)

注意:“sudo setsebool httpd_can_network_connect_db 1”我试过了,但没有用

相关内容