472,125 Members | 1,390 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,125 software developers and data experts.

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

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_ipin /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?

Sep 18 '06 #1
0 1251

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Grant Collins | last post: by
reply views Thread by Liza | last post: by
1 post views Thread by ptaz | last post: by
reply views Thread by Christopher | last post: by
3 posts views Thread by B Squared | last post: by
16 posts views Thread by davemateer | last post: by
5 posts views Thread by eisenstein | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.