You are here: Re: Connection pooling in PHP ? « PHP Programming Language « IT news, forums, messages
Re: Connection pooling in PHP ?

Posted by ZeldorBlat on 12/20/05 06:01

Susan Baker wrote:
> Does PHP (or maybe the web server - Apache in my case), support
> (database) connection pooling?. It seems terribly inefficient if every
> request for data wil incurr the overhead of creating a connection to the
> db.
>

Sure. Look at the pconnect() family of functions. The exact function
will depend on the database system you're connecting to. For MySQL
it's mysql_pconnect().

pconnect() will leave the connection open when done and reuse idle
connections if available. Be careful, though -- I've seen some weird
problems with connections not being properly closed, especially when a
query blocks.

Although it may seem inefficient to open a new database connection each
time, I'd try both ways (connect() and pconnect()) and see if you
really notice a difference. If you don't, it's probably worth sticking
to plain old connect().

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация