Re: Undefined function pg_connect()

Lists: pgsql-php
From: Gustavo Amarilla Santacruz <gusamasan(at)gmail(dot)com>
To: pgsql-php(at)postgresql(dot)org
Subject: Undefined function pg_connect()
Date: 2010-01-28 00:25:44
Message-ID: e4ea2d811001271625r21024e05s5b74340b322b85d5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-php

Hello, all.

I had installed php + postgresql on Fedora12. When the php script call to
"pg_connect()", the following message is displayed:

Fatal error: Call to undefined function pg_connect() in /var/www/html/ .....
Call Stack: 0.0325 487160 1. {main}() ....

What i can do?

Thank you, in advance.

-------------------------
Gustavo Amarilla


From: Chris <dmagick(at)gmail(dot)com>
To: Gustavo Amarilla Santacruz <gusamasan(at)gmail(dot)com>
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: Undefined function pg_connect()
Date: 2010-01-28 00:36:51
Message-ID: 4B60DC23.9020404@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-php

Gustavo Amarilla Santacruz wrote:
> Hello, all.
>
> I had installed php + postgresql on Fedora12. When the php script call
> to "pg_connect()", the following message is displayed:
>
> Fatal error: Call to undefined function pg_connect() in /var/www/html/
> ..... Call Stack: 0.0325 487160 1. {main}() ....
>
>
> What i can do?

You need the php-pgsql package if you installed via rpm.

Once you have that installed, restart apache and see how you go.

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


From: Devrim GÜNDÜZ <devrim(at)gunduz(dot)org>
To: Gustavo Amarilla Santacruz <gusamasan(at)gmail(dot)com>
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: Undefined function pg_connect()
Date: 2010-01-28 00:40:47
Message-ID: 1264639247.2016.336.camel@hp-laptop2.gunduz.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-php

On Wed, 2010-01-27 at 21:25 -0300, Gustavo Amarilla Santacruz wrote:

> I had installed php + postgresql on Fedora12. When the php script call
> to "pg_connect()", the following message is displayed:
>
> Fatal error: Call to undefined function pg_connect()

If you are installing from RPMs, you also need to install php-pgsql
package. If you are installing from sources, you will need to recompile
with PostgreSQL support.

--
Devrim GÜNDÜZ, RHCE
Command Prompt - http://www.CommandPrompt.com
devrim~gunduz.org, devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org Twitter: http://twitter.com/devrimgunduz


From: Gustavo Amarilla Santacruz <gusamasan(at)gmail(dot)com>
To: Chris <dmagick(at)gmail(dot)com>
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: Undefined function pg_connect()
Date: 2010-01-28 13:35:49
Message-ID: e4ea2d811001280535j5d182a83s819a2b0590867dd5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-php

Thank you, Chris.

I use the yum command and i got the following result:

yum install php-pgsql
Loaded plugins: presto, refresh-packagekit
Setting up Install Process
Package php-pgsql-5.3.1-1.fc12.i686 already installed and latest version
Nothing to do

What i can do?

Thank you, in advance.

On Wed, Jan 27, 2010 at 9:36 PM, Chris <dmagick(at)gmail(dot)com> wrote:

> Gustavo Amarilla Santacruz wrote:
>
>> Hello, all.
>>
>> I had installed php + postgresql on Fedora12. When the php script call to
>> "pg_connect()", the following message is displayed:
>>
>> Fatal error: Call to undefined function pg_connect() in /var/www/html/
>> ..... Call Stack: 0.0325 487160 1. {main}() ....
>>
>>
>> What i can do?
>>
>
> You need the php-pgsql package if you installed via rpm.
>
> Once you have that installed, restart apache and see how you go.
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>
>

---------------------------
Gustavo Amarilla


From: Bill Moran <wmoran(at)potentialtech(dot)com>
To: Gustavo Amarilla Santacruz <gusamasan(at)gmail(dot)com>
Cc: Chris <dmagick(at)gmail(dot)com>, pgsql-php(at)postgresql(dot)org
Subject: Re: Undefined function pg_connect()
Date: 2010-01-28 13:44:15
Message-ID: 20100128084415.4d98823a.wmoran@potentialtech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-php

In response to Gustavo Amarilla Santacruz <gusamasan(at)gmail(dot)com>:

> Thank you, Chris.
>
> I use the yum command and i got the following result:
>
> yum install php-pgsql
> Loaded plugins: presto, refresh-packagekit
> Setting up Install Process
> Package php-pgsql-5.3.1-1.fc12.i686 already installed and latest version
> Nothing to do

Have you restarted Apache since it was successfully installed?

--
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/


From: Gustavo Amarilla Santacruz <gusamasan(at)gmail(dot)com>
To: Bill Moran <wmoran(at)potentialtech(dot)com>
Cc: Chris <dmagick(at)gmail(dot)com>, pgsql-php(at)postgresql(dot)org
Subject: Re: Undefined function pg_connect()
Date: 2010-01-28 23:40:48
Message-ID: e4ea2d811001281540x4e9f2eabp9557ea36e8f0bcbf@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-php

Thank you, Bill Moran.

My httpd is stoped, for default.

I used the command: service httpd start; then, the following message was
displayed:

Starting httpd: [Thu Jan 28 20:27:39 2010] [warn] module perl_module is
already loaded, skipping
[Thu Jan 28 20:27:39 2010] [warn] module php5_module is already loaded,
skipping
httpd: Could not reliably determine the server's fully qualified domain
name, using localhost.localdomain for ServerName
[ OK ]

But the pg_connect function is not recognized.

On Thu, Jan 28, 2010 at 10:44 AM, Bill Moran <wmoran(at)potentialtech(dot)com>wrote:

> In response to Gustavo Amarilla Santacruz <gusamasan(at)gmail(dot)com>:
>
> > Thank you, Chris.
> >
> > I use the yum command and i got the following result:
> >
> > yum install php-pgsql
> > Loaded plugins: presto, refresh-packagekit
> > Setting up Install Process
> > Package php-pgsql-5.3.1-1.fc12.i686 already installed and latest version
> > Nothing to do
>
> Have you restarted Apache since it was successfully installed?
>
> --
> Bill Moran
> http://www.potentialtech.com
> http://people.collaborativefusion.com/~wmoran/<http://people.collaborativefusion.com/%7Ewmoran/>
>

--
Gustavo Amarilla

¿Reciclaste papel, hoy?


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-28 23:53:19
Message-ID: 4B62236F.1090200@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-php

Gustavo Amarilla Santacruz wrote:
> Thank you, Bill Moran.
>
> My httpd is stoped, for default.
>
> I used the command: service httpd start; then, the following message was
> displayed:
>
> Starting httpd: [Thu Jan 28 20:27:39 2010] [warn] module perl_module is
> already loaded, skipping
> [Thu Jan 28 20:27:39 2010] [warn] module php5_module is already loaded,
> skipping
> httpd: Could not reliably determine the server's fully qualified domain
> name, using localhost.localdomain for ServerName
> [ OK ]
>
>
> But the pg_connect function is not recognized.

Does a phpinfo() page show it loading anything re: pgsql ?

Anything in apache logs (/var/log/httpd/error.log probably) ?

Could seLinux be involved somehow (I'm not really sure where to look for
this, something in /var/log should have some info) ?

On your phpinfo page, it should have something like this:

Configuration File (php.ini) Path /etc/php.ini
Scan this dir for additional .ini files /etc/php.d

Check whether the rpm put a file in that extra directory, like:

# cat /etc/php.d/pgsql.ini
; Enable pgsql extension module
extension=pgsql.so

If it didn't, try doing it manually (and restart httpd) and see if pgsql
shows up in your phpinfo page now.

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


From: Gustavo Amarilla Santacruz <gusamasan(at)gmail(dot)com>
To: Chris <dmagick(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-30 01:07:27
Message-ID: e4ea2d811001291707l62c3c8ccs4a74b9d95a43bc8b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-php

On Thu, Jan 28, 2010 at 8:53 PM, Chris <dmagick(at)gmail(dot)com> wrote:

> Gustavo Amarilla Santacruz wrote:
>
>> Thank you, Bill Moran.
>>
>> My httpd is stoped, for default.
>>
>> I used the command: service httpd start; then, the following message was
>> displayed:
>>
>> Starting httpd: [Thu Jan 28 20:27:39 2010] [warn] module perl_module is
>> already loaded, skipping
>> [Thu Jan 28 20:27:39 2010] [warn] module php5_module is already loaded,
>> skipping
>> httpd: Could not reliably determine the server's fully qualified domain
>> name, using localhost.localdomain for ServerName
>> [ OK ]
>>
>>
>> But the pg_connect function is not recognized.
>>
>
> Does a phpinfo() page show it loading anything re: pgsql ?
>
> Anything in apache logs (/var/log/httpd/error.log probably) ?
>
> Could seLinux be involved somehow (I'm not really sure where to look for
> this, something in /var/log should have some info) ?
>
>
> On your phpinfo page, it should have something like this:
>
> Configuration File (php.ini) Path /etc/php.ini
> Scan this dir for additional .ini files /etc/php.d
>
>
> Check whether the rpm put a file in that extra directory, like:
>
> # cat /etc/php.d/pgsql.ini
> ; Enable pgsql extension module
> extension=pgsql.so
>
> If it didn't, try doing it manually (and restart httpd) and see if pgsql
> shows up in your phpinfo page now.
>
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>
>

Thank you, Chris

*1) Does a phpinfo() page show it loading anything re: pgsql ?*

No, no matter info on pgsql.

*2) Anything in apache logs (/var/log/httpd/error.log probably) ?*

Yes, i found this:

.
.
.
PHP Warning: PHP Startup: Unable to load dynamic library
'./;/usr/lib/php/modules/;/usr/lib/pgsql/curl.so' -
./;/usr/lib/php/modules/;/usr/lib/pgsql/curl.so: cannot open shared object
file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library
'./;/usr/lib/php/modules/;/usr/lib/pgsql/fileinfo.so' -
./;/usr/lib/php/modules/;/usr/lib/pgsql/fileinfo.so: cannot open shared
object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library
'./;/usr/lib/php/modules/;/usr/lib/pgsql/json.so' -
./;/usr/lib/php/modules/;/usr/lib/pgsql/json.so: cannot open shared object
file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library
'./;/usr/lib/php/modules/;/usr/lib/pgsql/ldap.so' -
./;/usr/lib/php/modules/;/usr/lib/pgsql/ldap.so: cannot open shared object
file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library
'./;/usr/lib/php/modules/;/usr/lib/pgsql/mysql.so' -
./;/usr/lib/php/modules/;/usr/lib/pgsql/mysql.so: cannot open shared object
file: No such file or directory in Unknown on line 0
.
.
.

*
3) On your phpinfo page, it should have something like this:

Configuration File (php.ini) Path /etc/php.ini
Scan this dir for additional .ini files /etc/php.d

*
Yes, the phpinfo page has this information.

*
4) Check whether the rpm put a file in that extra directory, like:

# cat /etc/php.d/pgsql.ini
; Enable pgsql extension module
extension=pgsql.so*

Yes, the rpm put that file in /etc/php.d

----------------------------
Gustavo Amarilla


From: Gustavo Amarilla Santacruz <gusamasan(at)gmail(dot)com>
To: Chris <dmagick(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-30 12:33:24
Message-ID: e4ea2d811001300433l7d466afdt8fa40bf4bc5fd0e8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-php

On Fri, Jan 29, 2010 at 10:07 PM, Gustavo Amarilla Santacruz <
gusamasan(at)gmail(dot)com> wrote:

>
>
> On Thu, Jan 28, 2010 at 8:53 PM, Chris <dmagick(at)gmail(dot)com> wrote:
>
>> Gustavo Amarilla Santacruz wrote:
>>
>>> Thank you, Bill Moran.
>>>
>>> My httpd is stoped, for default.
>>>
>>> I used the command: service httpd start; then, the following message was
>>> displayed:
>>>
>>> Starting httpd: [Thu Jan 28 20:27:39 2010] [warn] module perl_module is
>>> already loaded, skipping
>>> [Thu Jan 28 20:27:39 2010] [warn] module php5_module is already loaded,
>>> skipping
>>> httpd: Could not reliably determine the server's fully qualified domain
>>> name, using localhost.localdomain for ServerName
>>> [ OK ]
>>>
>>>
>>> But the pg_connect function is not recognized.
>>>
>>
>> Does a phpinfo() page show it loading anything re: pgsql ?
>>
>> Anything in apache logs (/var/log/httpd/error.log probably) ?
>>
>> Could seLinux be involved somehow (I'm not really sure where to look for
>> this, something in /var/log should have some info) ?
>>
>>
>> On your phpinfo page, it should have something like this:
>>
>> Configuration File (php.ini) Path /etc/php.ini
>> Scan this dir for additional .ini files /etc/php.d
>>
>>
>> Check whether the rpm put a file in that extra directory, like:
>>
>> # cat /etc/php.d/pgsql.ini
>> ; Enable pgsql extension module
>> extension=pgsql.so
>>
>> If it didn't, try doing it manually (and restart httpd) and see if pgsql
>> shows up in your phpinfo page now.
>>
>>
>> --
>> Postgresql & php tutorials
>> http://www.designmagick.com/
>>
>>
>
>
> Thank you, Chris
>
>
>
> *1) Does a phpinfo() page show it loading anything re: pgsql ?*
>
> No, no matter info on pgsql.
>
>
> *2) Anything in apache logs (/var/log/httpd/error.log probably) ?*
>
> Yes, i found this:
>
> .
> .
> .
> PHP Warning: PHP Startup: Unable to load dynamic library
> './;/usr/lib/php/modules/;/usr/lib/pgsql/curl.so' -
> ./;/usr/lib/php/modules/;/usr/lib/pgsql/curl.so: cannot open shared object
> file: No such file or directory in Unknown on line 0
> PHP Warning: PHP Startup: Unable to load dynamic library
> './;/usr/lib/php/modules/;/usr/lib/pgsql/fileinfo.so' -
> ./;/usr/lib/php/modules/;/usr/lib/pgsql/fileinfo.so: cannot open shared
> object file: No such file or directory in Unknown on line 0
> PHP Warning: PHP Startup: Unable to load dynamic library
> './;/usr/lib/php/modules/;/usr/lib/pgsql/json.so' -
> ./;/usr/lib/php/modules/;/usr/lib/pgsql/json.so: cannot open shared object
> file: No such file or directory in Unknown on line 0
> PHP Warning: PHP Startup: Unable to load dynamic library
> './;/usr/lib/php/modules/;/usr/lib/pgsql/ldap.so' -
> ./;/usr/lib/php/modules/;/usr/lib/pgsql/ldap.so: cannot open shared object
> file: No such file or directory in Unknown on line 0
> PHP Warning: PHP Startup: Unable to load dynamic library
> './;/usr/lib/php/modules/;/usr/lib/pgsql/mysql.so' -
> ./;/usr/lib/php/modules/;/usr/lib/pgsql/mysql.so: cannot open shared object
> file: No such file or directory in Unknown on line 0
> .
> .
> .
>
>
> *
> 3) On your phpinfo page, it should have something like this:
>
>
> Configuration File (php.ini) Path /etc/php.ini
> Scan this dir for additional .ini files /etc/php.d
>
> *
> Yes, the phpinfo page has this information.
>
> *
> 4) Check whether the rpm put a file in that extra directory, like:
>
>
> # cat /etc/php.d/pgsql.ini
> ; Enable pgsql extension module
> extension=pgsql.so
> *
>
>
> Yes, the rpm put that file in /etc/php.d
>
>
>
>
> ----------------------------
> Gustavo Amarilla
>
>

I commented the php.ini line in the extension_dir parameter:

*Before:*
.
.
.
; 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/"
.
.
.

*After:*
.
.
.
; 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/"
.
.
.

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?"

The pg_hba.conf file containt:

# TYPE DATABASE USER CIDR-ADDRESS METHOD

# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1 255.255.255.0 trust
# IPv6 local connections:
host all all ::1/128 ident

What i can do?

Thank you, in advance.

--------------------------
Gustavo Amarilla


From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: Gustavo Amarilla Santacruz <gusamasan(at)gmail(dot)com>
Cc: Chris <dmagick(at)gmail(dot)com>, Bill Moran <wmoran(at)potentialtech(dot)com>, pgsql-php(at)postgresql(dot)org
Subject: Re: Undefined function pg_connect()
Date: 2010-01-30 12:53:11
Message-ID: 4B642BB7.80907@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-php

On 30/01/2010 12:33, Gustavo Amarilla Santacruz wrote:
> "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?"
>
>
>
>
> The pg_hba.conf file containt:
>

Sounds like you're getting somewhere - the PG extension is being found now.

The error above is nothing to do with pg_hba.conf; if the connection was
being denied because of a rule there, the error would say so explicitly.
Rather, it's a network problem of some kind. Is the server actually
running? Is there a firewall preventing access?

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod(at)iol(dot)ie


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
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/


From: Gustavo Amarilla Santacruz <gusamasan(at)gmail(dot)com>
To: Chris <dmagick(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-02-02 00:03:34
Message-ID: e4ea2d811002011603u98f5fd4k6934d68fc66bb352@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-php

Thank you, all.

I had access to the SELinux->Boolean; next, i check the option:

"Allow HTTPD scripts and modules to connect to databases over the network".

Then, a new message was displayed:

Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: Ident
authentication failed for user "gestock" .......

I can login with gestock data (user/password) through the postgresql psql
tool. But from apache i can not.

Note: the php.ini file was not modified.

On Sun, Jan 31, 2010 at 7:21 PM, Chris <dmagick(at)gmail(dot)com> wrote:

>
> ; 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/
>
>

--
Gustavo Amarilla


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-02-02 00:13:33
Message-ID: 4B676E2D.5060903@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-php

Gustavo Amarilla Santacruz wrote:
> Thank you, all.
>
> I had access to the SELinux->Boolean; next, i check the option:
>
> "Allow HTTPD scripts and modules to connect to databases over the
> network".
>
>
> Then, a new message was displayed:
>
> Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL:
> Ident authentication failed for user "gestock" .......
>
>
> I can login with gestock data (user/password) through the postgresql
> psql tool. But from apache i can not.

It's not using the password, it's just checking the username to see if
you're logged in as 'gestock' (but 'apache' is not 'gestock', hence the
error).

What does your postgresql pg_hba.conf file look like?

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


From: Gustavo Amarilla Santacruz <gusamasan(at)gmail(dot)com>
To: Chris <dmagick(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-02-02 00:51:00
Message-ID: e4ea2d811002011651i451f7939q8eb0a34d4b38d5be@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-php

Thank you, Chris.

The pg_hba.conf contained:

# TYPE DATABASE USER CIDR-ADDRESS METHOD

# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1 255.255.255.0 trust
# IPv6 local connections:
host all all ::1/128 ident

Before, i modified to:

# TYPE DATABASE USER CIDR-ADDRESS METHOD

# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1 255.255.255.0 trust
# IPv6 local connections:
host all all ::1/128 trust

Then i can login me. But, how i Know that apache is using IPV6 connections?

On Mon, Feb 1, 2010 at 9:13 PM, Chris <dmagick(at)gmail(dot)com> wrote:

> Gustavo Amarilla Santacruz wrote:
>
>> Thank you, all.
>>
>> I had access to the SELinux->Boolean; next, i check the option:
>>
>> "Allow HTTPD scripts and modules to connect to databases over the
>> network".
>>
>>
>> Then, a new message was displayed:
>>
>> Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL:
>> Ident authentication failed for user "gestock" .......
>>
>>
>> I can login with gestock data (user/password) through the postgresql psql
>> tool. But from apache i can not.
>>
>
> It's not using the password, it's just checking the username to see if
> you're logged in as 'gestock' (but 'apache' is not 'gestock', hence the
> error).
>
> What does your postgresql pg_hba.conf file look like?
>
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>
>

--
Gustavo Amarilla

¿Reciclaste papel, hoy?


From: Gustavo Amarilla Santacruz <gusamasan(at)gmail(dot)com>
To: Chris <dmagick(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-02-02 00:54:33
Message-ID: e4ea2d811002011654v6b29236bi33119e60691e1e3a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-php

I am sorry. Please, ommit the previous post.

The correct post is the following:

Thank you, Chris.

The pg_hba.conf file contained this:

# TYPE DATABASE USER CIDR-ADDRESS METHOD

# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1 255.255.255.0 trust
# IPv6 local connections:
host all all ::1/128 ident

After, i modified it to:

# TYPE DATABASE USER CIDR-ADDRESS METHOD

# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1 255.255.255.0 trust
# IPv6 local connections:
host all all ::1/128 trust

Then i can login me from php scripts. But, how i Know that apache is using
IPV6 connections?

On Mon, Feb 1, 2010 at 9:51 PM, Gustavo Amarilla Santacruz <
gusamasan(at)gmail(dot)com> wrote:

> Thank you, Chris.
>
> The pg_hba.conf contained:
>
>
> # TYPE DATABASE USER CIDR-ADDRESS METHOD
>
> # "local" is for Unix domain socket connections only
> local all all trust
> # IPv4 local connections:
> host all all 127.0.0.1 255.255.255.0 trust
> # IPv6 local connections:
> host all all ::1/128 ident
>
>
> Before, i modified to:
>
>
> # TYPE DATABASE USER CIDR-ADDRESS METHOD
>
> # "local" is for Unix domain socket connections only
> local all all trust
> # IPv4 local connections:
> host all all 127.0.0.1 255.255.255.0 trust
> # IPv6 local connections:
> host all all ::1/128 trust
>
>
> Then i can login me. But, how i Know that apache is using IPV6 connections?
>
>
>
> On Mon, Feb 1, 2010 at 9:13 PM, Chris <dmagick(at)gmail(dot)com> wrote:
>
>> Gustavo Amarilla Santacruz wrote:
>>
>>> Thank you, all.
>>>
>>> I had access to the SELinux->Boolean; next, i check the option:
>>>
>>> "Allow HTTPD scripts and modules to connect to databases over the
>>> network".
>>>
>>>
>>> Then, a new message was displayed:
>>>
>>> Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL:
>>> Ident authentication failed for user "gestock" .......
>>>
>>>
>>> I can login with gestock data (user/password) through the postgresql psql
>>> tool. But from apache i can not.
>>>
>>
>> It's not using the password, it's just checking the username to see if
>> you're logged in as 'gestock' (but 'apache' is not 'gestock', hence the
>> error).
>>
>> What does your postgresql pg_hba.conf file look like?
>>
>>
>> --
>> Postgresql & php tutorials
>> http://www.designmagick.com/
>>
>>
>
>
> --
> Gustavo Amarilla
>
> ¿Reciclaste papel, hoy?
>

--
Gustavo Amarilla

¿Reciclaste papel, hoy?