Skip to Content.
Sympa Menu

freetds - Re: [freetds] Connecting to SQL Server using PHP

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Bill Sim" <BSim AT navman.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Connecting to SQL Server using PHP
  • Date: Thu, 21 Jul 2005 16:45:35 +1200

The issue was resolved by rebuilding apache and php from source rather
than rpm installation... Thanks for the help, it got me going in the
right direction.

Bill

-----Original Message-----
From: freetds-bounces AT lists.ibiblio.org
[mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of Daniel Fazekas
Sent: Wednesday, 20 July 2005 4:11 p.m.
To: FreeTDS Development Group
Subject: Re: [freetds] Connecting to SQL Server using PHP


On Jul 20, 2005, at 4:18, Bill Sim wrote:

> Then I try to run a query but the
> query fails with the message: DB Error: unknown error, which is not
> particularly useful as you can imagine.

Even less useful to us if you don't give us some more information to
go on.

I don't have any experience using the pear DB abstraction layer
myself, but looking at its web page,
http://pear.php.net/package/DB
...it seems it could go through both the mssql or odbc extensions.
Which one are you trying to use?
Show us some example of what kind of code you've got.

Also, how did you install the aforementioned extensions for php,
either mssql or odbc? Did you compile your own copy or was it a pre-
compiled binary?

Check that they are properly loaded. For example do a
print_r(get_loaded_extensions());
Is odbc in the list? Is mssql in the list?

The quickest way to find the cause of a problem is to narrow it down
as much as possible.

Some of the ways to do that:
- Try things without using the DB abstraction layer; going directly
with the odbc_* or mssql_* functions as detailed in the PHP Manual.

- Try getting Apache out of the picture. If you have shell access to
the server and it's got a properly installed cli SAPI version of php,
you could simply try running your scripts there with
php /path/to/your/script.php

- Enable FreeTDS' logging facilities by setting the TDSDUMP
environment variable to a writable file name. This is where the
earlier step, getting Apache out of the way, could simplify things
tremendously. Setting that environment variable in the right place so
that it takes effect in time is not the easiest task when going
through Apache. If you have shell access, you could even conveniently
direct logging to stdout, thereby eliminating possible access right
problems:
TDSDUMP=stdout php /path/to/your/script.php

If that doesn't result in a bunch of lines related to FreeTDS
outputted when you try to run your database-accessing script, FreeTDS
didn't even get involved yet.

--
fds




Archive powered by MHonArc 2.6.24.

Top of Page