Skip to Content.
Sympa Menu

freetds - [freetds] TDS, PHP and OpenBSD

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Matthew L. McCarty" <matthew AT rareearthstrategies.com>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] TDS, PHP and OpenBSD
  • Date: Tue, 15 Feb 2005 11:06:18 -0600

On code that previously worked on a Linux machine I am receiving the
following errors for the apache error_log:

[Mon Feb 14 22:35:25 2005] [error] PHP Warning: mssql_connect(): Sybase:
Unable to connect in /pulaski-ssl/functions/db.inc on line 17
[Mon Feb 14 22:35:25 2005] [error] PHP Warning: mssql_connect(): Sybase:
Unable to connect in /pulaski-ssl/functions/db.inc on line 17
[Mon Feb 14 22:35:25 2005] [error] PHP Warning: mssql_select_db(): supplied
argument is not a valid Sybase-Link resource in /pulaski-ssl/functions/db.inc
on line 25
[Mon Feb 14 22:35:25 2005] [error] PHP Fatal error: Cannot redeclare
gettext() in /pulaski-ssl/functions/sqlfunctions.inc on line 444


Around lines Line 17 and 25 in db.inc is:

$Connect = db_connect("MSSQL",$logname,$password);
$FrameworkConnect = db_connect("MSSQL","Framework","Framework");
//$db = db_select_db($dbname,$Connect);
db_select_db($dbname,$Connect);
function db_connect ($server, $user, $pass){
return mssql_connect ($server, $user, $pass);
}
function db_close ($db_link){
return mssql_close ($db_link);
}
function db_select_db ($db_name, $db_link){
return mssql_select_db ($db_name, $db_link);
}
function db_query ($query_string, $db_link, $Debug = 0){
if($Debug == 1){
echo "$query_string<BR>";
}


I am running this system on a fresh install of OpenBSD 3.6, PHP, PHP sybase,
and TDS installed from the packages. Of course Apache is installed and all
running as chroot.

I tried just using tsql to see if I can even get a connection but I am unsure
of the messages it is giving me, although I say use 3389 it always tries to
use 4000:

# tsql -S 10.0.1.7 -p 3389 -U tsqltest
locale is "C"
using default charset "ISO-8859-1"
Password:
src/tds/login.c: tds_connect: 10.0.1.7:4000: Connection refused
Msg 20009, Level 9, State 0, Server OpenClient, Line 0
Server is unavailable or does not exist.
There was a problem connecting to the server

So I am not sure - even if Iget php to use freetds, that it will work.


I am thinking that I may have to build php from source with this option I
found on the FreeTDS web site:
Example 6-6. PHP and db-lib for "Sybase"

First build FreeTDS normally.

$ ./configure --prefix=/usr/local/freetds
$ make
$ su root
Password:
$ make install

Then build PHP with support for "Sybase"

$ cd php
$ ./configure --with-sybase=/usr/local/freetds
$ make
$ su root
Password:
$ make install

I am not sure however since I have sybase php installed from the packages and
php.info() returns it as an installed module. Perhaps I am missing some
libraries or something in the chroot.

If anybody has any clues or pointers on using freetds in a chroot
environment, and how to work around my errors, I would appreciate it.

Thanks,

Matthew L. McCarty






Archive powered by MHonArc 2.6.24.

Top of Page