Re: [Phplib-users] mysql_pconnect & db_mysql.inc
Brought to you by:
nhruby,
richardarcher
From: Giancarlo <gia...@na...> - 2002-10-18 09:53:07
|
Il 03:10, venerd=EC 18 ottobre 2002, Mike Gifford ha scritto: mysql_pconnect is optional, and will work as plain mysql_connect if=20 persistent connections are disabled in php.ini or .htaccess or eve with a= =20 ini_set(...) statement on top of the scripts. So there should be no need to change the code, but rather configure the m= ysql=20 service either to bear more connections, mainly by shortening the=20 wait_timeout option (preferred. since default is 8 hours, 2-3 minutes are= =20 OK!), or by increasing max_connection. Or disable at all presistent=20 connections in php.ini/htaccess/ini_set().=20 No change in code should be required then, if you can tune the other two=20 params (=3D have root access). If you don't have privileges to do that, an .htaccess directive can overr= ide=20 the general php.ini mysql.allow_persistent (or how the heck is that spec) Gian > Hello phplib folks, > > I've heard that mysql_pconnect has some problems, especially if it isn'= t > installed as an apache module. > > I did a search for problems with mysql_pconnect and didn't fid a lot. > Mostly this (which is pretty vague): > http://www.dotxtra.net/support/php.htm > > There is a report here with problems with PHP 4.1.1, but I haven't hear= d > anything about any other versions. > http://www.php.net/manual/en/function.mysql-pconnect.php > > From what I could see from php.net the official version is to tweek > apache & MySQL: > > We were running into an issue of too many open connections. > > Warning: Host 'db.ourserver.org' is blocked because of many > connection errors. Unblock with 'mysqladmin flush-hosts' in > /home/mike/phplib/db_mysql.inc on line 75 > > This one here actually.. > > From what I've read persistent connections should reduce the number of > db connections, unless they are set to persist a bit too long in which > case it has the opposite effect. > > I see from here (think this is the right one): > http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/phplib/php-lib-stable/ph= p/db >_mysql.inc?rev=3D1.11&content-type=3Dtext/vnd.viewcvs-markup > > that you haven't switched to (on line 72): > $this->halt("connect($Host, $User, \$Password) failed."); > > If you have to change the wait_timeout, what would be considered a low > (buit reasonable) value? > > Any additional insights on this would be appreciated.. > > Mike |