473,378 Members | 1,446 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 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:

Versions:
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:
<html>
<body>
<?php

$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);

mssql_close ($con);
?>
</body>
</html>

Any ideas anyone?

Sep 18 '06 #1
0 1314

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: bertoulin | last post by:
When I run my script via the shell (e.g. "php test.php") the script generates the correct output everytime. If I attempt to access the script via the web (e.g. http://localhost/test.php), Apache...
5
by: Grant Collins | last post by:
Hi I am writing a web based application as part of a small project that I am undertaking using servlets beans and jsp. I already have one servlet - bean - jsp page working and I have written...
0
by: Liza | last post by:
Hi, I run Tomcat5.0.24 on Fedora Core 1. I have two hosts defined in server.xml in a following way: <Host name ="WebTest1.something.com" debug="0" appBase="webapps" unpackWARs="true"...
1
by: ptaz | last post by:
Hi I'm trying to run a web page but I get the following error. Ca anyone please tell me a solution to this. Thanks Ptaz HTTP Status 500 - type Exception report
0
by: Christopher | last post by:
I am running: Fedora Core 1 Python 2.4 Apache 1.3.3 mod_python 2.7.11 When I try to access the test mptest.py file I receive: > Internal Server Error
3
by: B Squared | last post by:
I've having a problem getting PHP to work with Apache. I've just installed Apache and on a Fedora core3 system. The installs were pretty painless, just as expected. Then I pointed to a simple web...
16
by: davemateer | last post by:
Hi We have a current system: Linux / Apache / PHP4.x talking to Microsoft SQL 2000 Thinking about going to: Windows 2003 / PHP4.x talking to the same Microsoft SQL 2000 box...
8
by: eugenio | last post by:
Hi...not sure if this is the right group for this posting, but i'm don't know where else to post. I've got a simple problem...I have a linux box running apache 2.0 and php5. I'm trying to use the...
5
by: eisenstein | last post by:
i read out an utf-8 xml file with greek or russian/cyrillic characters. i can display it in the browser but if i insert data into an mssql database -field is nvarchar(4000)- i only see ??? or...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.