unixODBC工作,但Apache不会连接
问题描述:
我想设置Apache连接到Microsoft SQL服务器进行身份验证。这并不理想,但这个遗留系统在MSSQL中拥有凭证,并且不能更改。我有unixODBC的设置和工作unixODBC工作,但Apache不会连接
**odbcinst.ini**
[SQL Server Native Client 11.0]
Description = Microsoft SQL Server ODBC Driver V1.0 for Linux
Driver = /opt/microsoft/sqlncli/lib64/libsqlncli-11.0.so.1790.0
Threading = 1
UsageCount = 1
**odbc.ini**
[mssql]
Driver = SQL Server Native Client 11.0
Server = 192.168.250.200
Database = DBName
当我连接使用isql我能没有问题
isql mssql username password
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
查询数据库,在Apache中我已经配置了以下
DBDriver odbc
DBDParams "datasource=mssql,user=username;pass=password"
DBDMin 1
DBDKeep 2
DBDMax 10
DBDExptime 300
当我启动httpd我在错误日志中得到这个
[Thu Dec 10 09:10:35 2015] [dbd_odbc] SQLDriverConnect returned SQL_ERROR (-1) at dbd/apr_dbd_odbc.c:1146 [unixODBC][Microsoft][SQL Server Native Client 11.0]Login timeout expired HYT00 [unixODBC][Microsoft][SQL Server Native Client 11.0]TCP Provider: Error code 0xD 08001 [unixODBC][Microsoft][SQL Server Native Client 11.0]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 confi 08001
[Thu Dec 10 09:10:35.633986 2015] [dbd:error] [pid 15481] (20014)Internal error: AH00629: Can't connect to odbc: [dbd_odbc] SQLDriverConnect returned SQL_ERROR (-1) at dbd/apr_dbd_odbc.c:1146 [unixODBC][Microsoft][SQL Server Native Client 11.0]Login timeout expired HYT00 [unixODBC][Microsoft][SQL Server Native Client 11.0]TCP Provider: Error code 0xD 08001 [unixODBC][Microsoft][SQL Server Native Client 11.0]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 confi 08001
[Thu Dec 10 09:10:35.634054 2015] [dbd:error] [pid 15481] (20014)Internal error: AH00633: failed to initialise
[Thu Dec 10 09:10:35.634200 2015] [dbd:crit] [pid 15481] (20014)Internal error: AH00636: child init failed!
答
SELinux阻止了来自Apache的连接。