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 Answers1

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.