Skip to Content.
Sympa Menu

freetds - Re: [freetds] PHP PDO object not working with freetds/unixODBC

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Daniel Fazekas <fdsubs AT t-online.hu>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] PHP PDO object not working with freetds/unixODBC
  • Date: Tue, 23 Dec 2008 21:41:22 +0100

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 command line?

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 available settings.

As root, either
setsebool -P httpd_can_network_connect_db 1
or
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.




Archive powered by MHonArc 2.6.24.

Top of Page