Thread: pg_connect(): Cannot create new link

pg_connect(): Cannot create new link

From
mauro.folcarelli@sistinf.it
Date:
I have the same problem posted by James Ward (Date: Mon, 15 Sep 2003)

I migrated from (postgresql-7.3.2-3 and php-4.2.2-17) to
 (postgresql-7.3.4-2 and php-4.3.3-6).

When I connect to the Database via php, I get the following message:

Warning: pg_connect(): Cannot create new link. Too many open links (0).

I didn't change any configuration file: everything used to work.
It's the first connection to the database
(max connections should be 32 by default).

Is it a bug ? Any solution?
Is there a chance to bypass it?

Thanks a lot.
Mauro Folcarelli


Re: pg_connect(): Cannot create new link

From
"scott.marlowe"
Date:
On Wed, 14 Jan 2004 mauro.folcarelli@sistinf.it wrote:

> I have the same problem posted by James Ward (Date: Mon, 15 Sep 2003)
>
> I migrated from (postgresql-7.3.2-3 and php-4.2.2-17) to
>  (postgresql-7.3.4-2 and php-4.3.3-6).
>
> When I connect to the Database via php, I get the following message:
>
> Warning: pg_connect(): Cannot create new link. Too many open links (0).
>
> I didn't change any configuration file: everything used to work.
> It's the first connection to the database
> (max connections should be 32 by default).
>
> Is it a bug ? Any solution?
> Is there a chance to bypass it?

What does

ps ax|grep postgres|wc -l

say?  If it says 34 or so, then yes, you have that many connections.  You
may have a problem with your apache processes hanging / dying oddly and
keeping the postgresql connections open.  restart postgresql with

pg_ctl -m fast stop
pg_ctl start

and see if you can connect.


Re: pg_connect(): Cannot create new link

From
ljb
Date:
mauro.folcarelli@sistinf.it wrote:
> I have the same problem posted by James Ward (Date: Mon, 15 Sep 2003)
>
> I migrated from (postgresql-7.3.2-3 and php-4.2.2-17) to
>  (postgresql-7.3.4-2 and php-4.3.3-6).
>
> When I connect to the Database via php, I get the following message:
>
> Warning: pg_connect(): Cannot create new link. Too many open links (0).
>
> I didn't change any configuration file: everything used to work.
> It's the first connection to the database
> (max connections should be 32 by default).
>
> Is it a bug ? Any solution?
> Is there a chance to bypass it?

Did you check for the same situation which was causing him the problem?
He wrote:
:: I had installed the latest version of PHP with postgres support built-in.
:: But in the previous version I had those sorts of extensions as shared
:: extensions.
:: Because none of the config files had changed it was still loading the OLD
:: extensions.
:: Once I deleted them it worked fine.

Re: pg_connect(): Cannot create new link

From
Adam Alkins
Date:
Try replacing your php.ini file with a default distribution file.

mauro.folcarelli@sistinf.it wrote:

>I have the same problem posted by James Ward (Date: Mon, 15 Sep 2003)
>
>I migrated from (postgresql-7.3.2-3 and php-4.2.2-17) to
> (postgresql-7.3.4-2 and php-4.3.3-6).
>
>When I connect to the Database via php, I get the following message:
>
>Warning: pg_connect(): Cannot create new link. Too many open links (0).
>
>I didn't change any configuration file: everything used to work.
>It's the first connection to the database
>(max connections should be 32 by default).
>
>Is it a bug ? Any solution?
>Is there a chance to bypass it?
>
>Thanks a lot.
>Mauro Folcarelli
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
>
>
>
>


--
Adam Alkins
1-868-627-9115
http://www.rasadam.com


Attachment

Re: pg_connect(): Cannot create new link

From
mauro.folcarelli@sistinf.it
Date:
In my /etc/php.ini file I had this line:
extension=pgsql.so
(now removed).

; Note: For Red Hat Linux, packaged extension modules are now loaded via
; the ini files in the directory /etc/php.d.

# ls -l /etc/php.d
-rw-r--r--    1 root     root           51 10 nov 16:40 pgsql.ini

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

Thank you for help!
Now it's ok!!

Mauro