php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28159 pg_pconnect(): Cannot create new link. Too many open links (0)
Submitted: 2004-04-26 17:46 UTC Modified: 2004-04-26 19:27 UTC
From: johnny at skydiveflorida dot net Assigned:
Status: Not a bug Package: PostgreSQL related
PHP Version: 4.3.4 OS: Debian linux
Private report: No CVE-ID: None
 [2004-04-26 17:46 UTC] johnny at skydiveflorida dot net
Description:
------------
When I make a call to pg_pconnect(), I get the error:

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

My system configuration:
seven:/etc/php4/apache# dpkg -l | grep php4
ii  php4           4.3.4-4        A server-side, HTML-embedded scripting langu
ii  php4-curl      4.3.4-4        CURL module for php4
ii  php4-gd2       4.3.2+rc3-2    GD module (with GD2) for php4
ii  php4-mysql     4.3.4-4        MySQL module for php4
ii  php4-pear      4.1.2-6woody3  PEAR - PHP Extension and Application Reposit
ii  php4-pgsql     4.3.3-2        PostgreSQL module for php4
ii  php4-xslt      4.3.4-4        XSLT module for php4

seven:/etc/php4/apache# dpkg -l | grep postgres
ii  postgresql     7.4.2-0.backpo Object-relational SQL database, descended fr
ii  postgresql-cli 7.4.2-0.backpo Front-end programs for PostgreSQL
ii  postgresql-doc 7.2.1-2woody4  Documentation for the PostgreSQL database.

PHPInfo() for pgsql:

pgsql
PostgreSQL Support enabled 
PostgreSQL(libpq) Version  7.4.2  
Multibyte character support  enabled  
SSL support  enabled  
Active Persistent Links  0  
Active Links  0  

Directive Local Value Master Value 
pgsql.allow_persistent On On 
pgsql.auto_reset_persistent Off Off 
pgsql.ignore_notice Off Off 
pgsql.log_notice Off Off 
pgsql.max_links 150 150 
pgsql.max_persistent 100 100 


Note that .max_links and .max_persistent were originally set to unlimited in php.ini (ie -1) but I tried changing the values to determine if the outcome would be different.

I realise that bug reports for previous versions (6+ months ago) have been submitted and answered, but I've read them and they do not solve the issue, they just suggest using the latest stable version of php4 

Reproduce code:
---------------
function connect()
{

        $this->dsn = "host='" . $this->hostName . "' port='" . $this->port . "' dbname='" . $this->database . "' user='" . $this->userName . "' password='". $this->passwd . "'";

        $this->link = pg_pconnect($this->dsn);
...
        return $this->link;
}

This code was tested and working using previous version of php4 / php4-pgsql packages as described above.

The line that causes the error is 
$this->link = pg_pconnect(...);



Expected result:
----------------
expect connection to be made to the postgres database.


Actual result:
--------------
Actual result is a warning, not a crash.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-26 19:27 UTC] derick@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

You really *do* need to try the latest version first.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 26 18:01:33 2024 UTC