开发者

Using php to connect to mysql using mod_dbd

开发者 https://www.devze.com 2023-01-17 12:14 出处:网络
I would like to use mod_dbd to implement connection pooling for my php application. I am able to define the mod_dbd module for apache and I can see the connections that it is op开发者_如何学编程ening,

I would like to use mod_dbd to implement connection pooling for my php application. I am able to define the mod_dbd module for apache and I can see the connections that it is op开发者_如何学编程ening, but I am not able to "hook on" those connections with my php code. I was trying mysql_connect with parameters and without as well as mysql_pconnect.

Welcome any advice,

Ariel


In order to benefit from the connection pooling feature of mod_dbd you would need to run a threaded MPM so that several threads can share the connections in the pool. Unfortunately I do believe PHP is not thread-safe, and will not support threaded MPMs.

If you use mod_dbd with the pre-fork MPM (which is not threaded and recommended for PHP) mod_dbd will create a single persistent database connection, which does not give you any huge advantage compared to a database connection in PHP not using mod_dbd.


http://bugs.php.net/bug.php?id=51865&edit=1

One should implement this as an extension like mysqlnd is implemented, allowing others to inherit from the abstraction code. Its quite possible such a thing might come up in PECL, but for the Core PHP its not very likely that any of us are going to work on it.

Also you have to keep in mind that it requires alot of changes to allow connection pooling while under Apache, and at the same time allowing an extension to use another, non Apache based webserver, like IIS to work with. Else the extension would get way too limited.

Just quoting from what I googled

0

精彩评论

暂无评论...
验证码 换一张
取 消