0

Had unixODBC working very well. Decided that we wanted to implement Kerberos authentication to lock down different sites in Apache to certain user groups. Once this got enabled, connecting to the database via Apache (using PHP) no longer worked.

I can get successful connections using sqlcmd from the same box. My output, when viewing source, is:

Teams: Could not connect.
Array
(
    [0] => Array
        (
            [0] => HYT00
            [SQLSTATE] => HYT00
            [1] => 0
            [code] => 0
            [2] => [unixODBC][Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired
            [message] => [unixODBC][Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired
        )

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

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

I have read though quite a few write ups about similar issues, but nothing seems to stand out or work.

Any guidance would be greatly appreciated.

-Wes

0

I figured it out!

I remembered having to mess with some SELinux attributed... After searching again, I found the value was httpd_can_network_connect_db. I performed a getsebool on it and found that it was back off...

Executed: sudo setsebool httpd_can_network_connect_db 1 and everything worked perfectly!

Follow up question: Does this reset after every reboot?

  • 1
    You need to use -P to make it persistent, otherwise it is temporary. – Michael Hampton Jan 31 at 1:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.