[freetds] TDS, PHP and OpenBSD
Matthew L. McCarty
matthew at rareearthstrategies.com
Tue Feb 15 12:06:18 EST 2005
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
More information about the FreeTDS
mailing list