Re: Database Connections

From: Date: Fri, 29 Nov 2002 16:01:16 +0000
Subject: Re: Database Connections
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-23737@lists.php.net to get a copy of this message
I think that generally PHP closes any non-persistent connections for you when you leave your script, so that it's not necessary to clean up after your script is done. You can create persistent connections, but in a high-traffic site they tend to become a resource problem after a while--and your server will be able to maintain only a finite number of connections open anyway. IMHO, before worrying about keeping the connections open, it's a good idea to take a good look at your setup and determine whether there are ways to improve upon its design. For example, you can use replication and have an instance of MySQL running on each web server, so that all database connections are local and performed through UNIX sockets, which are generally the fastest (assuming you're running UNIX, of course). This may require a bit of data redesign, but it's worked for me in the past. Marco -- ------------ php|architect - The magazine for PHP Professionals The monthly worldwide magazine dedicated to PHP programmers Come visit us at http://www.phparch.com!

« previous php.db (#23737) next »