News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Gonzalo Ayuso's Blog:
Database connection pooling with PHP and React (node.php)
May 21, 2012 @ 10:19:44

In this latest post Gonzalo Ayuso his recent experiences with <1 href="http://nodephp.org/">React (Node.js in PHP) and an example of how he worked up a script to pool database connections.

Last saturday I meet a new hype: "React" also known as "node.php". Basically it's the same idea than node.js but built with PHP instead of javascript. [...] Basically I want to create a database connection pooling. It's one of the things that I miss in PHP. I wrote a post here some time ago with this idea with one exotic experiment building one connection pooling using gearman. Today the idea is the same but now with React.

He includes the sample script, also including the line to add to your composer.json file to install React and the SQL to create the sample tables. The script makes a PDO connection and assigns it to the pool, an instance of his "CPool" class. If you want to try it out, you can find the code over on github.

0 comments voice your opinion now!
react nodejs nodephp database connection pool


Gonzalo Ayuso's Blog:
Database connection pooling with PHP and gearman
November 01, 2010 @ 09:07:51

Gonzalo Ayuso has a new post to his blog today looking at using the Gearman tool to pool database connections for his application and make them available for easy reuse.

Handling Database connections with PHP is pretty straightforward. Just open database connection, perform the actions we need, and close it. There's a little problem. We cannot create a pool of database connections. We need to create the connection in every request. Create and destroy, again and again. [...] In this post I'm going to try to explain a personal experiment to create a connection pooling using gearman.

He includes a basic database connection example with PDO, logging into a single database and fetching all of the results. To integrate this into the gearman functionality, he creates a configuration class to hold connection details and the worker code (along with some libraries to help manage the connections) that gets the results, serializes them and returns them back to the calling script.

0 comments voice your opinion now!
database connection pool gearman pdo



Community Events





Don't see your event here?
Let us know!


zendserver framework voicesoftheelephpant interview list threedevsandamaybe api bugfix laravel language community deployment tips series introduction code release podcast symfony conference

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework