Explorar el Código

Enable PDO persistent connections

Turn on persistent connections. Seems to result in noticeable speed improvements in my very unscientific local apachebench results.
Alan hace 12 años
padre
commit
8d24187219
Se han modificado 1 ficheros con 5 adiciones y 5 borrados
  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();
 
+$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(
     'db.options' => array(
-        'driver' => 'pdo_mysql',
-        'host' => '192.168.100.102',
-        'dbname' => 'hello_world',
-        'user' => 'benchmarkdbuser',
-        'password' => 'benchmarkdbpass',
+    'pdo' => $dbh
     ),
 ));