Do you have a question? Post it now! No Registration Necessary. Now with pictures!
September 18, 2006, 12:53 pm
rate this thread
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
Some extra info:
Fedora Core 5 Server install
SecureLinux is not enabled
The test file is something like this:
$con = mssql_connect("an_ip_address", "sa", "thePass");
mssql_select_db ("MYDB", $con);
$sql= "SELECT TOP 5 [MYCOL] FROM [MYTABLE]";
$rs= mssql_query ($sql, $con);
echo "Col Val 1 is: ";
echo mssql_result ($rs, 0, 0);
Any ideas anyone?