Skip to Content.
Sympa Menu

freetds - Re: [freetds] PHP odbc_connect : sql error

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] PHP odbc_connect : sql error
  • Date: Tue, 16 Dec 2008 01:20:56 -0500

Rowland, TJ (LVA) wrote:
> I can connect to SQL Server with both tsql and isql, and also from a
> shell using the php command.
...
> I checked my freetds.log file and the following errors were noted:
> net.c:204:Connecting to 10.1.1.51 port 1214 (TDS version 5.0)
> net.c:258:tds_open_socket: connect(2) returned "Permission denied"

What we have here is a failure to communicate. (Sorry, I couldn't help
myself.)

It's the kernel: the account hosting your webserver lacks permission to
open an outbound TCP connection.

Have another look at the man page for connect(2) on your system. ("man
errno" may also help). You should find something like this:

[EACCES]
Search permission is denied for a component of the
path prefix, or write access to the named socket is
denied.

That's what happened: FreeTDS tried to connect to the server. To do that,
it invokes the socket API system call, connect(2). That call failed with
EACESS, meaning the process is not allowed to make that connection.

> I thought it might be a firewall problem

No, it's not the firewall. A firewall doesn't grant *permission*, really.
It passes or doesn't pass packets, but it's just a network gate. To the
sending application, a firewall that's dropping packets looks like a
faulty network, and the most likely error is a timeout.

I don't know how a process can be so constrained; maybe your firewall is
part of your kernel and causes connect(2) to behave that way. But in any
case, look no further than your local box for the answer.

HTH.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page