Skip to Content.
Sympa Menu

freetds - Re: [freetds] FREETDS WITH ODBC NOT WORKING WITH PHP5

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] FREETDS WITH ODBC NOT WORKING WITH PHP5
  • Date: Wed, 6 Jun 2007 15:12:37 -0400

Riley Griffin wrote:
> I am able to use isql and
> tsql and connect to the mssql server and query the database. The
> problem occurs when I try running a php script. I get an error when
> attempting to connect to the database:
>
> [unixODBC][FreeTDS][SQL Server]Unable to connect to data source
>
> I tried using logs to find the problem:

Well done! ;-)

> util.c:288:Starting log file for FreeTDS 0.64
> on 2007-06-06 09:25:58 with debug flags 0x4fff.
...
> net.c:168:Connecting to (Server IP) port 1433.
> net.c:237:tds_open_socket: (Server IP):1433: Permission denied

If the server ip address and port are correct, chances are you're reading
freetds.conf (or you're very lucky).

The "Permission denied" means connect(2) received an EACCES error when it
tried to open the connection. It's not that the server couldn't be found
or reached; it's that the socket was not allowed to be opened.

(The current snapshot is more explicit; the message you'd see at the ODBC
level would be "Unable to open socket".)

You need to ensure the account running your webserver has rights to open
an outbound tcp connection.

HTH.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page