Re: Undefined function pg_connect()

From: Chris <dmagick(at)gmail(dot)com>
To: Gustavo Amarilla Santacruz <gusamasan(at)gmail(dot)com>
Cc: Bill Moran <wmoran(at)potentialtech(dot)com>, pgsql-php(at)postgresql(dot)org
Subject: Re: Undefined function pg_connect()
Date: 2010-01-31 22:21:53
Message-ID: 4B660281.5060007@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php


> ; Directory in which the loadable extensions (modules) reside.
> ; http://www.php.net/manual/en/ini.core.php#ini.extension-dir
> ; extension_dir = "./"
> ;extension_dir = "./;/usr/lib/php/modules/;/usr/lib/pgsql/"

These should be colon separated, not semicolon - notice it's trying to
load both paths included:

PHP Warning: PHP Startup: Unable to load dynamic library
'./;/usr/lib/php/modules/;/usr/lib/pgsql/curl.so'

Change it to

extension_dir = "./:/usr/lib/php/modules/:/usr/lib/pgsql/"

> Then, a new message was displayed:
>
> "Warning: pg_connect(): Unable to connect to PostgreSQL server: could
> not connect to server: Permission denied Is the server running on host
> "localhost" and accepting TCP/IP connections on port 5432? could not
> connect to server: Permission denied Is the server running on host
> "localhost" and accepting TCP/IP connections on port 5432?"

"Permission denied" sounds like either file permissions or seLinux is
stopping the connection.

If you have seLinux enabled, try disabling it (don't know how to do
that, sorry) - at least that will tell you if that's the problem.

For file permissions, check your apache user can read where-ever the
postgres socket file is put (normally /tmp/.s.PGSQL.5432 on centos/rhel).

--
Postgresql & php tutorials
http://www.designmagick.com/

In response to

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Gustavo Amarilla Santacruz 2010-02-02 00:03:34 Re: Undefined function pg_connect()
Previous Message Raymond O'Donnell 2010-01-30 12:53:11 Re: Undefined function pg_connect()