Browse Source

Enable PDO persistent connections

Turn on persistent connections. Seems to result in noticeable speed improvements in my very unscientific local apachebench results.
Alan 12 years ago
parent
commit
8d24187219
1 changed files with 5 additions and 5 deletions
  1. 5 5
      php-silex/web/index.php

+ 5 - 5
php-silex/web/index.php

@@ -9,13 +9,13 @@ require_once __DIR__.'/../vendor/autoload.php';
 
 
 $app = new Silex\Application();
 $app = new Silex\Application();
 
 
+$dbh = new PDO('mysql:host=192.168.100.102;dbname=hello_world', 'benchmarkdbuser', 'benchmarkdbpass', array(
+    PDO::ATTR_PERSISTENT => true
+));
+
 $app->register(new Silex\Provider\DoctrineServiceProvider(), array(
 $app->register(new Silex\Provider\DoctrineServiceProvider(), array(
     'db.options' => array(
     'db.options' => array(
-        'driver' => 'pdo_mysql',
-        'host' => '192.168.100.102',
-        'dbname' => 'hello_world',
-        'user' => 'benchmarkdbuser',
-        'password' => 'benchmarkdbpass',
+    'pdo' => $dbh
     ),
     ),
 ));
 ));