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

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

am 25.04.2006 01:11:05 von John Oliver

Fedora Core 2, httpd-2.0.54-10.2, php-4.3.10-2.4,
postgresql-7.4.7-3.FC2.1

Using a test.php that includes:

pg_connect("host=localhost dbname=db_name user=user password=password$");
phpinfo();
?>

I get PHP Warning: pg_connect(): Cannot create new link. Too many open
links (0) in /home/www/mywebsite.com/html/index.php on line 2

I did have a line extension=pgsql.so in /etc/php.ini but have removed
it. I do have /etc/php.d/pgsql.ini that contains the same line. That's
the solution that all responses I've found have suggested. What else
can I try?

--
* John Oliver http://www.john-oliver.net/ *
* Reform California gun laws - http://www.reformcagunlaws.com/ *
* http://www.gunownersca.com - http://www.crpa.org/ *
* San Diego shooters come to http://shooting.forsandiego.com/ *

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

am 25.04.2006 03:14:01 von unknown

Post removed (X-No-Archive: yes)

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

am 25.04.2006 06:22:21 von John Oliver

On Tue, 25 Apr 2006 01:14:01 GMT, ljb wrote:
> joliver@john-oliver.net wrote:
>> Fedora Core 2, httpd-2.0.54-10.2, php-4.3.10-2.4,
>> postgresql-7.4.7-3.FC2.1
>>
>> Using a test.php that includes:
>>
>> >> pg_connect("host=localhost dbname=db_name user=user password=password$");
>> phpinfo();
>> ?>
>>
>> I get PHP Warning: pg_connect(): Cannot create new link. Too many open
>> links (0) in /home/www/mywebsite.com/html/index.php on line 2
>>
>> I did have a line extension=pgsql.so in /etc/php.ini but have removed
>> it. I do have /etc/php.d/pgsql.ini that contains the same line. That's
>> the solution that all responses I've found have suggested. What else
>> can I try?
>
> This sounded familiar... I found a thread from 2003 where somebody had the
> same error. I assume you checked phpinfo() output and made sure
> pgsql.max_links isn't set too low, and that your script isn't caught
> in a loop allocating new connections. I told that person:

FWIW, it turned out that I needed to restart httpd. I'd been restarting
PostGreSQL.

> So I think you are on the right track. I don't know what
> /etc/php.d/pgsql.ini does... it isn't standard with either PHP or
> PostgreSQL. But make sure you are using only one PHP PostgreSQL extension
> (built-in, or dynamically loaded), and if dynamically loaded make sure it
> was built for your version of PHP.

That's a Red hat-ism. AAMOF, it turned out that I was calling the MySQL
module twice, and even though it still worked it was logging tons and
tons of errors about duplicates. So I fixed two problems, one I hadn't
realized that I had :-)

--
* John Oliver http://www.john-oliver.net/ *
* Reform California gun laws - http://www.reformcagunlaws.com/ *
* http://www.gunownersca.com - http://www.crpa.org/ *
* San Diego shooters come to http://shooting.forsandiego.com/ *

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

am 25.04.2006 11:13:28 von richard.a.fletcher

> * Reform California gun laws - http://www.reformcagunlaws.com/ *
> * http://www.gunownersca.com - http://www.crpa.org/ *
> * San Diego shooters come to http://shooting.forsandiego.com/ *

If you want to announce your politics, that's fine. I shall do the
same. Guns are evil, and kill lots of people. In the UK we have an
unarmed police force and for that I am grateful. This is not a pro-gun
group. It is not an anti-gun group. Politics has no place here.

Now, your problem.

> I did have a line extension=pgsql.so in /etc/php.ini but have removed
> it. I do have /etc/php.d/pgsql.ini that contains the same line. That's
> the solution that all responses I've found have suggested. What else
> can I try?

Do a phpinfo() to see which config file you are using.
"extension=pgsql.so " will need to be in that file. Then come back to
us.