Skip to Content.
Sympa Menu

freetds - Re: [freetds] PHP5-MsSQL Error

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: jklowden AT schemamania.org
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] PHP5-MsSQL Error
  • Date: Wed, 30 Aug 2006 18:02:16 -0400

On Wed, Aug 30, 2006 at 10:39:25AM -0400, Brian Morton wrote:
> It looks like mssql_connect is trying to use ctlib (which should work).
> But it doesn't appear to be using your FreeTDS.

I'm sorry, but there's so much wrong in this message I have to correct for
the sake of the archives. Beginning with the top-posting....

Yes, I see ct-lib's ct_connect being called. It's the FreeTDS
implementation,
though, not Sybases's as we can see by the fact that it's a FreeTDS log
we're reading. The log includes the server's complaint, that it could not
authenticate the login. As far as the server's concerned, that's the
problem.

> I would say check your
> login. It is probably actually failing. Try connecting via tsql on the
> command line.

Good advice.

> Also, make sure you add the port 1433
> (mssql_connect(serverip:1433,...) in your PHP call. I have found that
> it explicitly requires this.

Because we see the server's message, we know he's connecting to the right
port, so this advice is spurious. But it's also a rumor: he should not have
to indicate the server's address and port in the connection. The
reason we have a freetds.conf is specifically to encapsulate server
information.
The client merely names the server; the library looks up the name, gets the
particulars, and forms the connection. Anything else is working too hard.

The part I don't understand is why mssql_coonnect is calling ct_connect.
I'm not a PHP guy, but afaik you're better off using the "mssql extension",
which uses db-lib.

I don't like to criticize other people's answers; my job is to encourage
a helpful and productive community. But if you think you know that something
(e.g. including the port in the connection information) is required
in exception to the documentation, please report it as a bug. Don't
slip it in as "helpful advice". The thing is either broken and needs fixing
(or better documentation) or it works and you could find out what you're
doing wrong. Go down that path and things get better. We don't have to
limp along with broken code and slips of paper passed under the table.

--jkl

> -----Original Message-----
> From: freetds-bounces AT lists.ibiblio.org
> [mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of Oswaldo Otero
> Sent: Wednesday, August 30, 2006 10:35 AM
> To: freetds AT lists.ibiblio.org
> Subject: [freetds] PHP5-MsSQL Error
>
> Hello everybody.
>
> I am trying to reach a MSSQL server via PHP but I had the follow
> error.
>
> /*************************************
> Warning: mssql_connect() [function.mssql-connect]: Sybase: Client
> message: Read from SQL server failed. (severity 78)
> in /var/www/phpinfo.php on line 12
>
> Warning: mssql_connect() [function.mssql-connect]: Sybase: Client
> message: Login incorrect. (severity 78) in /var/www/phpinfo.php on
> line
> 12
>
> Warning: mssql_connect() [function.mssql-connect]: Sybase: Unable to
> connect in /var/www/phpinfo.php on line 12
>
> Warning: mssql_select_db(): supplied argument is not a valid
> Sybase-Link
> resource in /var/www/phpinfo.php on line 13
>
> Warning: mssql_query(): supplied argument is not a valid Sybase-Link
> resource in /var/www/phpinfo.php on line 15
> The field number one is:
> Warning: mssql_result(): supplied argument is not a valid Sybase
> result
> resource in /var/www/phpinfo.php on line 17
> **************************************/
>
> My system is running Debian Sarge with PHP5 and Freetds-stable(I just
> downloaded it two days ago). I didn't compiled from the regular PHP
> sources instead, what I did was get the source from the Debian package
> and the I modified the rules in the Debian packages to build into the
> MSSQL dynamic library.
>
> As you guys know, this MSSQL PHP library is using FreeTDS. But I am
> having the follow in the tds.log
>
>
> /*************************************
> Starting log file with debug level 99.
> 2006-08-30 05:55:55.524213 iconv will convert client-side data to the
> "ANSI_X3.4-1968" character set
> 2006-08-30 05:55:55.528972 Connecting addr 10.1.1.12 port 1433 with
> TDS
> version 7.0
> 2006-08-30 05:55:55.529750 inside tds_process_login_tokens()
> Received header @ 2006-08-30 05:55:55.530652
> 0000 04 01 00 d8 00 00 01 00 |........|
>
>
> Received packet @ 2006-08-30 05:55:55.530719
> 0000 aa c4 00 14 48 00 00 01 0e 5c 00 4c 00 6f 00 67
> |....H... .\.L.o.g|
> 0010 00 69 00 6e 00 20 00 66 00 61 00 69 00 6c 00 65
> |.i.n. .f .a.i.l.e|
> 0020 00 64 00 20 00 66 00 6f 00 72 00 20 00 75 00 73
> |.d. .f.o .r. .u.s|
> 0030 00 65 00 72 00 20 00 27 00 28 00 6e 00 75 00 6c
> |.e.r. .' .(.n.u.l|
> 0040 00 6c 00 29 00 27 00 2e 00 20 00 52 00 65 00 61
> |.l.).'.. . .R.e.a|
> 0050 00 73 00 6f 00 6e 00 3a 00 20 00 4e 00 6f 00 74
> |.s.o.n.: . .N.o.t|
> 0060 00 20 00 61 00 73 00 73 00 6f 00 63 00 69 00 61
> |. .a.s.s .o.c.i.a|
> 0070 00 74 00 65 00 64 00 20 00 77 00 69 00 74 00 68
> |.t.e.d. .w.i.t.h|
> 0080 00 20 00 61 00 20 00 74 00 72 00 75 00 73 00 74
> |. .a. .t .r.u.s.t|
> 0090 00 65 00 64 00 20 00 53 00 51 00 4c 00 20 00 53
> |.e.d. .S .Q.L. .S|
> 00a0 00 65 00 72 00 76 00 65 00 72 00 20 00 63 00 6f
> |.e.r.v.e .r. .c.o|
> 00b0 00 6e 00 6e 00 65 00 63 00 74 00 69 00 6f 00 6e
> |.n.n.e.c .t.i.o.n|
> 00c0 00 2e 00 00 00 00 00 fd 02 00 00 00 00 00 00 00
> |........ ........|
>
>
> 2006-08-30 05:55:55.530898 inside tds_process_default_tokens() marker
> is
> aa(ERROR)
> 2006-08-30 05:55:55.531119 inside ct_con_props() action = CS_GET
> property = 9108
> 2006-08-30 05:55:55.531175 inside tds_process_default_tokens() marker
> is
> fd(DONE)
> 2006-08-30 05:55:55.531218 inside tds_process_end() more_results = 0,
> was_cancelled = 0
> 2006-08-30 05:55:55.531240 inside tds_process_default_tokens() setting
> state to COMPLETED
> Sending packet @ 2006-08-30 05:55:55.531402
> 0000 01 01 00 22 00 00 01 00 73 00 65 00 6c 00 65 00 |..."....
> s.e.l.e.|
> 0010 63 00 74 00 20 00 40 00 40 00 73 00 70 00 69 00 |c.t. .@.
> @.s.p.i.|
> 0020 64 00 |d.|
>
>
> 2006-08-30 05:55:55.531718 processing result tokens. marker is 0()
> 2006-08-30 05:55:55.531754 inside tds_process_default_tokens() marker
> is
> 0()
> 2006-08-30 05:55:55.531773 leaving tds_process_default_tokens()
> connection dead
> 2006-08-30 05:55:55.531791 tds_set_spid() failed
> 2006-08-30 05:55:55.531804 leaving tds_process_login_tokens()
> returning
> 0
> 2006-08-30 05:55:55.532050 leaving ct_connect() returning 0
> 2006-08-30 05:55:55.532136 inside ct_con_drop()
>
> **************************************/
>
> If you guys have any clue about how to solve this issue???/
> --
> Oswaldo Otero <oswaldo AT originalimpressions.com>
>
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds

--




Archive powered by MHonArc 2.6.24.

Top of Page