2015-12-10 90 views
0

我想設置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! 

回答

0

SELinux阻止了來自Apache的連接。