Re: PHP 5.2.6 + pdo_dblib + FreeTDS 0.64 -- tds_open_socket: Unknown error: 0
"Kian Mohageri" <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Jul 24, 2008 at 11:23 AM, James K. Lowden <[email protected]> wrote: > connect(2) may return only 0 or -1, and should set errno. It appears to > be returning nonzero, but not setting errno. (sock_errno is just errno > except on Win32.) That is, it reports failure but not why. > > The only conclusion I can draw is that your FreeTDS configuration is > correct, but something is amiss with your network setup that prevents your > PHP application from forming the connection. Moreover, IMO you have a > FreeBSD bug, because a non-zero return code from connect(2) must be > accompanied by a valid errno value. > I went ahead and looked into it some more and used your existing debugging code. connect(2) is returning -1 but not setting errno, as you said. I also checked that errno wasn't set to 0 explicitly (even though if I'm understanding correctly, that'd still be broken behavior). I've submitted a PR with FreeBSD. Still not sure why the connect is failing in the first place, but hopefully it's not something I've screwed up on my part. I find it really strange that it works in Apache but not CLI. Time will tell. Thanks for your help, -Kian