[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cobalt-users] [OT] mysql & php



Hi!

Some days ago I got errors from a php script using mysql:

"Too many connections..."

The problem is that the scripts (Nuke-php) uses mysql_pconnect function that
create a persistent connection.
Once reached the 100 connections the server refuses to open new one.

Now I temporairly resolved the problem setting the wait_timeout of mysql to
1800 sec. instead of the default 28800.
This will kill the sleeping connection sooner, freeing possibility for new
one.
Then I had some testing (show processlist) on the server and discovered that
when I ask for a new page it opens a new connection without re-using the old
ones even if they are sleeping. This happens until 6-5 connections are
opened, then it starts reusing  connections (even if not always).

I would like to know if my solution (setting a shorter wait_timeout) was
right, or if it would be better to use mysql_connect instaed of
mysql_pconnect or if there is someting else I can do.
Why the persistent connection aren't always reused?
What about server usage?

If this can halp I'm using php alredy installed in the Raq4 and mysql
installed from source code.