Skip to Content.
Sympa Menu

freetds - RE: [freetds] TDS, PHP and OpenBSD

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: <ml AT freetds.org>
  • Cc:
  • Subject: RE: [freetds] TDS, PHP and OpenBSD
  • Date: Wed, 16 Feb 2005 11:12:15 -0500

> From: Matthew L. McCarty
> Sent: Tuesday, February 15, 2005 12:06 PM
>
> 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
...
> 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.

tsql -S servername works, reading the port from freetds.conf or
equivalent.
tsql -H hostname -p port works, bypassing freetds.conf.

When using -S, -p is ignored. The tsql man page could be clearer on
this point.

Probably you don't have a freetds.conf entry where the servername is
'[10.0.1.7]', so the library infers that you provided an address, to
which it connects, using the compiled-in default port (4000).

Discussion topic. I wonder if the servername-lookup logic's fallback
plan isn't too clever by half. When it can't find a name in
freetds.conf, FreeTDS tries resolving it with DNS; if that fails, it
tries converting the name to an address. Is this really a feature,
given that the port it chooses has at best a 50% chance of being wrong?
Usually, the name lookup failure is an error. I think it would be
clearer to the user if the message were "No such servername '[10.0.1.7]'
found in <conf file>[, <conf file>...]".

> 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"
...
> I am not sure however since I have sybase php installed from the
> packages and php.info() returns it as an installed module.

I can't help you with the PHP errors. I think nowadays most people use
the mssql extension for Microsoft servers. PHP has to be linked to the
FreeTDS libraries, of course, but if you've already done that
--with-mssql, you don't have to redo it --with-sybase.

HTH.

--jkl

-----------------------------------------
The information contained in this transmission may contain privileged
and confidential information and is intended only for the use of the
person(s) named above. If you are not the intended recipient, or an
employee or agent responsible for delivering this message to the
intended recipient, any review, dissemination, distribution or
duplication of this communication is strictly prohibited. If you are not
the intended recipient, please contact the sender immediately by reply
e-mail and destroy all copies of the original message. Please note that
we do not accept account orders and/or instructions by e-mail, and
therefore will not be responsible for carrying out such orders and/or
instructions.
If you, as the intended recipient of this message, the purpose of which
is to inform and update our clients, prospects and consultants of
developments relating to our services and products, would not like to
receive further e-mail correspondence from the sender, please "reply" to
the sender indicating your wishes. In the U.S.: 1345 Avenue of the
Americas, New York, NY 10105.



-----------------------------------------
The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the original
message. Please note that we do not accept account orders and/or instructions
by e-mail, and therefore will not be responsible for carrying out such orders
and/or instructions.
If you, as the intended recipient of this message, the purpose of which is to
inform and update our clients, prospects and consultants of developments
relating to our services and products, would not like to receive further
e-mail correspondence from the sender, please "reply" to the sender
indicating your wishes. In the U.S.: 1345 Avenue of the Americas, New York,
NY 10105.





  • [freetds] TDS, PHP and OpenBSD, Matthew L. McCarty, 02/15/2005
    • <Possible follow-up(s)>
    • RE: [freetds] TDS, PHP and OpenBSD, Lowden, James K, 02/16/2005

Archive powered by MHonArc 2.6.24.

Top of Page