PHP (5.1.4) MSSQL functions do not work through Apache (on Fedora Core 5)

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Hi All

I'm trying to set up PHP with Microsoft SQL Server support on Fedora
Core 5. I've tried using the FreeTDS libraries, and a connect with
tsql works fine.

I've a little test PHP file that simply connects to a SQL Server
instance, executes a simple query and returns.

If I run php -f /var/www/html/testSqlServer.php it works. (I've run
it as root, a lesser user, and a very limited rights user)

If I access the same file through the browser (i.e. through Apache), it
fails giving this error message:
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to
server: <the_server_ip> in /var/www/html/testSqlServer.php on line 7

I've rebuilt PHP multiple times, redone this system, recompiled
FreeTDS in multiple ways, recompiled PHP in multiple ways, tried yum
installs, tried other sources (dries / remi), but I cannot figure out
why this might be.

I mean, it WORKS if you run php from the command line. I've tried
giving the Apache user explicit access to the binaries, etc. Really
stumped here.

Some extra info:

FreeTDS: 0.64
PHP: 5.1.4
Fedora Core 5 Server install
Apache 2
SecureLinux is not enabled

The test file is something like this:

$con = mssql_connect("an_ip_address", "sa", "thePass");

mssql_select_db ("MYDB", $con);
$rs= mssql_query ($sql, $con);
echo "Col Val 1 is: ";
echo mssql_result ($rs, 0, 0);

mssql_close ($con);

Any ideas anyone?

Site Timeline