Nate 8 years ago
parent
commit
ed8dc92f3c

+ 3 - 3
frameworks/PHP/php/dborm.php

@@ -8,7 +8,7 @@ header("Content-type: application/json");
 
 // Database connection
 // http://www.php.net/manual/en/ref.pdo-mysql.php
-// $pdo = new PDO('mysql:host=localhost;dbname=hello_world', 'benchmarkdbuser', 'benchmarkdbpass');
+// $pdo = new PDO('mysql:host=TFB-database;dbname=hello_world', 'benchmarkdbuser', 'benchmarkdbpass');
 
 # inclue the ActiveRecord library
 require_once 'vendor/php-activerecord/php-activerecord/ActiveRecord.php';
@@ -17,12 +17,12 @@ ActiveRecord\Config::initialize(function($cfg)
 {
   $cfg->set_model_directory('models');
   $cfg->set_connections(array('development' =>
-    'mysql://benchmarkdbuser:benchmarkdbpass@localhost/hello_world'));
+    'mysql://benchmarkdbuser:benchmarkdbpass@TFB-database/hello_world'));
 });
 
 // Read number of queries to run from URL parameter
 $query_count = 1;
-if (!empty($_GET)) {
+if (isset($_GET['queries']) && $_GET['queries'] > 0) {
   $query_count = $_GET["queries"];
 }
 

+ 2 - 2
frameworks/PHP/php/dbraw.php

@@ -5,13 +5,13 @@
 
 // Database connection
 // http://www.php.net/manual/en/ref.pdo-mysql.php
-$pdo = new PDO('mysql:host=localhost;dbname=hello_world', 'benchmarkdbuser', 'benchmarkdbpass', array(
+$pdo = new PDO('mysql:host=TFB-database;dbname=hello_world', 'benchmarkdbuser', 'benchmarkdbpass', array(
     PDO::ATTR_PERSISTENT => true
 ));
 
 // Read number of queries to run from URL parameter
 $query_count = 1;
-if (TRUE === isset($_GET['queries'])) {
+if (isset($_GET['queries']) && $_GET['queries'] > 0) {
   $query_count = $_GET['queries'];
 }
 

+ 1 - 1
frameworks/PHP/php/fortune.php

@@ -5,7 +5,7 @@
 
 // Database connection
 // http://www.php.net/manual/en/ref.pdo-mysql.php
-$pdo = new PDO('mysql:host=localhost;dbname=hello_world;charset=utf8', 'benchmarkdbuser', 'benchmarkdbpass', array(
+$pdo = new PDO('mysql:host=TFB-database;dbname=hello_world;charset=utf8', 'benchmarkdbuser', 'benchmarkdbpass', array(
     PDO::ATTR_PERSISTENT => true
 ));
 

+ 0 - 5
frameworks/PHP/php/setup.sh

@@ -2,11 +2,6 @@
 
 fw_depends mysql php7 nginx composer
 
-sed -i "s|localhost|${DBHOST}|g" dborm.php
-sed -i "s|localhost|${DBHOST}|g" dbraw.php
-sed -i "s|localhost|${DBHOST}|g" updateraw.php
-sed -i "s|localhost|${DBHOST}|g" fortune.php
-
 sed -i "s|TEST_ROOT|${TROOT}|g" deploy/php
 sed -i "s|TEST_ROOT|${TROOT}|g" deploy/nginx.conf
 

+ 0 - 5
frameworks/PHP/php/setup_php5.sh

@@ -2,11 +2,6 @@
 
 fw_depends mysql php5 nginx composer
 
-sed -i "s|localhost|${DBHOST}|g" dborm.php
-sed -i "s|localhost|${DBHOST}|g" dbraw.php
-sed -i "s|localhost|${DBHOST}|g" updateraw.php
-sed -i "s|localhost|${DBHOST}|g" fortune.php
-
 sed -i "s|TEST_ROOT|${TROOT}|g" deploy/php
 sed -i "s|TEST_ROOT|${TROOT}|g" deploy/nginx.conf
 

+ 2 - 2
frameworks/PHP/php/updateraw.php

@@ -5,13 +5,13 @@
 
 // Database connection
 // http://www.php.net/manual/en/ref.pdo-mysql.php
-$pdo = new PDO('mysql:host=localhost;dbname=hello_world', 'benchmarkdbuser', 'benchmarkdbpass', array(
+$pdo = new PDO('mysql:host=TFB-database;dbname=hello_world', 'benchmarkdbuser', 'benchmarkdbpass', array(
     PDO::ATTR_PERSISTENT => true
 ));
 
 // Read number of queries to run from URL parameter
 $query_count = 1;
-if (TRUE === isset($_GET['queries'])) {
+if (isset($_GET['queries']) && $_GET['queries'] > 0) {
   $query_count = $_GET['queries'];
 }