[freetds] can't connect through php

James K. Lowden jklowden at schemamania.org
Sat Jun 26 12:44:59 EDT 2004


On Fri, 25 Jun 2004, "Cory D. Wiles" wrote:
>
> I was able to install freetds just fine and I am able to telnet/use tsql
> 
> to connect to the database but when I try to do it through my php test 
> page I get a failed connection error.  I checked my freetds log and this
> 
> is what it said:
> TDS: Write failed in tds_write_packet
> Error: 111 (Connection refused)
> 12:01:32.279874 tds_client_msg: #20006: "Write to SQL Server failed.". 

Well, that means what it says: you failed to establish a connection.  The
message comes from write.c, line 438.  

Does the PHP box have network connectivity to the server's host?  

Perhaps the PHP environment is different from tsql's, such that PHP isn't
referencing the same freetds.conf?  Or perhaps it's not using the same
login, and is failing authentication?  

With TDS version 4.2, the login packet is written to the log, complete
with username and password.  You might try that, just to confirm the login
conforms to your expectations.  

--jkl



More information about the FreeTDS mailing list