1

Envoironment:

webserver: Debian8 with Apache, PHP, unixODBC, FreeTDS (current versions installed with apt-get last week)

dataserver: Windows Server 2008 with MS SQL Server 2008

Opening this in webbrowser: (variables are set and right)

<?php $connect = odbc_connect($db_server,$db_user,$db_password); var_dump($connect); 

I get:

Warning: odbc_connect(): SQL error: [unixODBC][FreeTDS][SQL Server]Unable to connect to data source, SQL state S1000 in SQLConnect in /var/www/html/test/index.php on line 11 bool(false)

Running the same file/code in command line results in:

resource(4) of type (odbc link)

Since i've read this could have something to do with SElinux i tried typing sestatus in command line resulting in

bash: sestatus: Command not found.

tsql/isql is also working.

Where do i have to make adjustments to allow apache to connect to the MSSQL Server?

1 Answer 1

1

To allow apache to communicate with the MSSQL, you should do the following:

setsebool -P httpd_can_network_connect on setsebool -P httpd_can_network_connect_db on 

In a couple of seconds you will be connected.

2
  • bash: setsebool: Command not found. Commented Oct 29, 2015 at 15:48
  • Worked for me after running around for days. Commented Nov 19, 2017 at 20:51

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.