Date: 06/27/00
- Next message: Bryan McGuire: "[phplib] mySQL error: Too many open connections"
- Previous message: Tobias Zadow: "[phplib] file-download with phplib and SSL enabled"
- In reply to: asdrury <email protected>: "[phplib] mySQL error: Too many open connections"
- Next in thread: Bryan McGuire: "[phplib] mySQL error: Too many open connections"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> but, what i can't get clear about is why it's happening, or what
> i, as a PHPLIB user, can do to avoid the problem.
>
> any insights very much appreciated.
You need to know a few things about how apache works. If you telnet into
your server and type in the unix command:
ps aux |fgrep httpd
You'll see a whole bunch of httpd processes listed, these are the child
servers that apache forked off to handle the incoming http requests. If your
server is busy, it directly corresponds to the maxclients settings in
apache's httpd.conf file. When apache receives a http request, it's pretty
much pot luck as to which one of those child servers is going to end up
handling it. So, potentially, there's a couple of hundred processes that
may need to make a connection to mysql. phplib has chosen to use persistant
connections for database access. What this means is that once a child
server makes a connection to mysql, it keeps the connection open after
processing the request so that connection can be reused the next time the
child server receives a request that requires access to mysql. This
connection stays open for the life of the child (child servers don't last
forever -- after maxrequests is reached, it is killed and another one is
forked off to replace it). If only some of your pages use mysql, it is
possible that during the child's lifetime, it may never need to open a
connection to mysql. On the other hand, every child may end up connecting
to mysql. It's kind of random.
The only way to be assured that you will avoid the "too many connections"
problem is to increase the maximum connections in mysql (or decrease the
maxclients in httpd.conf -- could be a really bad idea). Either way, you'll
need root access to do it yourself. If your provider won't increase the
mysql max connections, find one that will.
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>
- Next message: Bryan McGuire: "[phplib] mySQL error: Too many open connections"
- Previous message: Tobias Zadow: "[phplib] file-download with phplib and SSL enabled"
- In reply to: asdrury <email protected>: "[phplib] mySQL error: Too many open connections"
- Next in thread: Bryan McGuire: "[phplib] mySQL error: Too many open connections"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

