* Move pdo connection to app.php * Delete persistent db connection if all the workers are reusing the same connection, may be detrimental * Change in php-ngx-psgql.dockerfile
@@ -1,5 +1,9 @@
<?php
+global $pdo;
+$pdo = new PDO("mysql:host=tfb-database;dbname=hello_world", "benchmarkdbuser", "benchmarkdbpass");
+
function db()
{
global $pdo;
@@ -25,11 +25,6 @@ http {
php_ini_path /deploy/conf/php.ini;
init_worker_by_php '
- global $pdo;
- $pdo = new PDO("mysql:host=tfb-database;dbname=hello_world", "benchmarkdbuser", "benchmarkdbpass", [
- PDO::ATTR_PERSISTENT => true
- ]);
-
require "app.php";
';
@@ -26,7 +26,7 @@ RUN wget -q http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz && \
--add-module=/ngx_php7 > /dev/null && \
make > /dev/null && make install > /dev/null
-RUN sed -i "s|mysql:|pgsql:|g" /deploy/nginx.conf
+RUN sed -i "s|mysql:|pgsql:|g" /app.php
CMD /nginx/sbin/nginx -c /deploy/nginx.conf