[freetds] PHP PDO object not working with freetds/unixODBC
fdsubs at t-online.hu
Tue Dec 23 15:41:22 EST 2008
On Dec 23, 2008, at 21:14, Craig Metrolis wrote:
> Hi, I am trying to setup an odbc connection to a Microsoft SQL
> Express server using an "ODBC-combined" configuration. Both isql and
> tsql are working fine, but whenever I try to run a simple PHP script
> to connect to the same DSN, I am getting the following error,
Where is that PHP script running? Inside a web server? Could you
reproduce the failure even when trying to execute your script from the
You didn't say what operating system you're using, but it's becoming
quite a common occurrence here that people are surprised by the
default configuration of SELinux-enabled Linux distributions, where
apps running inside the web server are forbidden from accessing remote
addresses - including remote databases - as a security precaution.
If that applies to you, the man page httpd_selinux documents the
As root, either
setsebool -P httpd_can_network_connect_db 1
setsebool -P httpd_can_network_connect 1
will solve it.
The first one is more restrictive and only allows connections to
whatever your system considers common database server ports.
If that wasn't your problem, you'll have to look at the TDSDUMP
logging feature to figure out what's really going on.
More information about the FreeTDS