Browse Source

Merge branch 'master' of https://github.com/TechEmpower/FrameworkBenchmarks

Adam Chlipala 11 years ago
parent
commit
990224f239
100 changed files with 598 additions and 947 deletions
  1. 0 2
      .travis.yml
  2. 0 30
      frameworks/Java/play-java/.gitignore
  3. 0 27
      frameworks/Java/play-java/README.md
  4. 0 0
      frameworks/Java/play-java/__init__.py
  5. 0 81
      frameworks/Java/play-java/app/controllers/Application.java
  6. 0 20
      frameworks/Java/play-java/app/models/World.java
  7. 0 8
      frameworks/Java/play-java/app/utils/Predicate.java
  8. 0 26
      frameworks/Java/play-java/app/utils/Predicated.java
  9. 0 23
      frameworks/Java/play-java/app/utils/PredicatedAction.java
  10. 0 25
      frameworks/Java/play-java/benchmark_config
  11. 0 13
      frameworks/Java/play-java/build.sbt
  12. 0 74
      frameworks/Java/play-java/conf/application.conf
  13. 0 10
      frameworks/Java/play-java/conf/routes
  14. 0 3
      frameworks/Java/play-java/install.sh
  15. 0 1
      frameworks/Java/play-java/project/build.properties
  16. 0 8
      frameworks/Java/play-java/project/plugins.sbt
  17. 0 12
      frameworks/Java/play-java/setup.py
  18. 0 9
      frameworks/Java/play-java/source_code
  19. 4 4
      frameworks/Java/play2-java/README.md
  20. 43 25
      frameworks/Java/play2-java/generate_config.py
  21. 3 0
      frameworks/Java/play2-java/setup_common.py
  22. 2 2
      frameworks/Java/play2-java/setup_java.py
  23. 2 2
      frameworks/Java/play2-java/setup_java_ebean.py
  24. 22 0
      frameworks/PHP/README.md
  25. 7 0
      frameworks/PHP/hhvm/bash_profile.sh
  26. 1 1
      frameworks/PHP/hhvm/install.sh
  27. 6 10
      frameworks/PHP/hhvm/setup.py
  28. 7 0
      frameworks/PHP/php-codeigniter/bash_profile.sh
  29. 4 7
      frameworks/PHP/php-codeigniter/setup.py
  30. 7 0
      frameworks/PHP/php-fatfree/bash_profile.sh
  31. 3 0
      frameworks/PHP/php-fatfree/install.sh
  32. 7 10
      frameworks/PHP/php-fatfree/setup.py
  33. 7 0
      frameworks/PHP/php-fuel/bash_profile.sh
  34. 4 7
      frameworks/PHP/php-fuel/setup.py
  35. 7 0
      frameworks/PHP/php-kohana/bash_profile.sh
  36. 4 7
      frameworks/PHP/php-kohana/setup.py
  37. 7 0
      frameworks/PHP/php-laravel/bash_profile.sh
  38. 4 7
      frameworks/PHP/php-laravel/setup.py
  39. 7 0
      frameworks/PHP/php-lithium/bash_profile.sh
  40. 4 7
      frameworks/PHP/php-lithium/setup.py
  41. 7 0
      frameworks/PHP/php-micromvc/bash_profile.sh
  42. 4 7
      frameworks/PHP/php-micromvc/setup.py
  43. 7 0
      frameworks/PHP/php-phalcon-micro/bash_profile.sh
  44. 4 7
      frameworks/PHP/php-phalcon-micro/setup.py
  45. 7 0
      frameworks/PHP/php-phalcon/bash_profile.sh
  46. 4 7
      frameworks/PHP/php-phalcon/setup.py
  47. 9 0
      frameworks/PHP/php-phpixie/bash_profile.sh
  48. 1 1
      frameworks/PHP/php-phpixie/install.sh
  49. 7 10
      frameworks/PHP/php-phpixie/setup.py
  50. 9 0
      frameworks/PHP/php-pimf/bash_profile.sh
  51. 1 1
      frameworks/PHP/php-pimf/install.sh
  52. 6 9
      frameworks/PHP/php-pimf/setup.py
  53. 6 9
      frameworks/PHP/php-pimf/setup_raw.py
  54. 7 0
      frameworks/PHP/php-senthot/bash_profile.sh
  55. 4 7
      frameworks/PHP/php-senthot/setup.py
  56. 9 0
      frameworks/PHP/php-silex-orm/bash_profile.sh
  57. 1 1
      frameworks/PHP/php-silex-orm/install.sh
  58. 6 9
      frameworks/PHP/php-silex-orm/setup.py
  59. 9 0
      frameworks/PHP/php-silex/bash_profile.sh
  60. 1 1
      frameworks/PHP/php-silex/install.sh
  61. 6 9
      frameworks/PHP/php-silex/setup.py
  62. 6 9
      frameworks/PHP/php-silex/setup_raw.py
  63. 9 0
      frameworks/PHP/php-silica/bash_profile.sh
  64. 1 1
      frameworks/PHP/php-silica/install.sh
  65. 6 9
      frameworks/PHP/php-silica/setup.py
  66. 7 0
      frameworks/PHP/php-slim/bash_profile.sh
  67. 4 7
      frameworks/PHP/php-slim/setup.py
  68. 9 0
      frameworks/PHP/php-symfony2-stripped/bash_profile.sh
  69. 1 1
      frameworks/PHP/php-symfony2-stripped/install.sh
  70. 4 7
      frameworks/PHP/php-symfony2-stripped/setup.py
  71. 9 0
      frameworks/PHP/php-symfony2/bash_profile.sh
  72. 1 1
      frameworks/PHP/php-symfony2/install.sh
  73. 4 7
      frameworks/PHP/php-symfony2/setup.py
  74. 7 0
      frameworks/PHP/php-yaf/bash_profile.sh
  75. 4 7
      frameworks/PHP/php-yaf/setup.py
  76. 7 0
      frameworks/PHP/php-yii2/bash_profile.sh
  77. 4 7
      frameworks/PHP/php-yii2/setup.py
  78. 9 0
      frameworks/PHP/php-zend-framework/bash_profile.sh
  79. 1 1
      frameworks/PHP/php-zend-framework/install.sh
  80. 4 7
      frameworks/PHP/php-zend-framework/setup.py
  81. 7 0
      frameworks/PHP/php/bash_profile.sh
  82. 7 9
      frameworks/PHP/php/setup.py
  83. 7 0
      frameworks/PHP/phreeze/bash_profile.sh
  84. 6 9
      frameworks/PHP/phreeze/setup.py
  85. 11 14
      frameworks/Perl/kelp/README.md
  86. 4 0
      frameworks/Perl/kelp/app.ini
  87. 89 41
      frameworks/Perl/kelp/app.pl
  88. 26 3
      frameworks/Perl/kelp/benchmark_config
  89. 0 3
      frameworks/Perl/kelp/conf/config.pl
  90. 9 1
      frameworks/Perl/kelp/install.sh
  91. 2 2
      frameworks/Perl/kelp/setup.py
  92. 56 0
      frameworks/Perl/kelp/t/main.t
  93. 0 10
      frameworks/Perl/kelp/views/fortunes.tt
  94. 0 33
      frameworks/Scala/play-scala/.gitignore
  95. 0 27
      frameworks/Scala/play-scala/README.md
  96. 0 0
      frameworks/Scala/play-scala/__init__.py
  97. 0 93
      frameworks/Scala/play-scala/app/controllers/Application.scala
  98. 0 25
      frameworks/Scala/play-scala/app/models/Fortune.scala
  99. 0 54
      frameworks/Scala/play-scala/app/models/World.scala
  100. 0 20
      frameworks/Scala/play-scala/app/utils/PredicatedAction.scala

+ 0 - 2
.travis.yml

@@ -70,7 +70,6 @@ env:
     - "TESTDIR=Java/netty"
     - "TESTDIR=Java/ninja-resin"
     - "TESTDIR=Java/ninja-standalone"
-    - "TESTDIR=Java/play-java"
     - "TESTDIR=Java/play-java-jpa"
     - "TESTDIR=Java/play1"
     - "TESTDIR=Java/play1siena"
@@ -143,7 +142,6 @@ env:
     - "TESTDIR=Scala/lift-stateless"
     - "TESTDIR=Scala/plain"
     - "TESTDIR=Scala/play-activate-mysql"
-    - "TESTDIR=Scala/play-scala"
     - "TESTDIR=Scala/play-scala-mongodb"
     - "TESTDIR=Scala/play-slick"
     - "TESTDIR=Scala/play2-scala"

+ 0 - 30
frameworks/Java/play-java/.gitignore

@@ -1,30 +0,0 @@
-logs
-project/project
-project/target
-target
-tmp
-.history
-dist
-
-# Ignore all dotfiles...
-.*
-# except for .gitignore
-!.gitignore
-
-# Ignore Play! working directory #
-db
-eclipse
-lib
-log
-logs
-modules
-precompiled
-project/project
-project/target
-target
-tmp
-test-result
-server.pid
-*.iml
-*.eml
-

+ 0 - 27
frameworks/Java/play-java/README.md

@@ -1,27 +0,0 @@
-#Play Benchmarking Test
-
-This is the Play portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
-
-### JSON Encoding Test
-
-* [JSON test source](app/controllers/Application.java)
-
-### Data-Store/Database Mapping Test
-
-* [Database test controller](app/controllers/Application.java)
-* [Database test model](app/models/World.java)
-
-## Infrastructure Software Versions
-The tests were run with:
-
-* [Java OpenJDK 1.7.0_09](http://openjdk.java.net/)
-* [Play 2.1.0](http://http://www.playframework.com/)
-
-## Test URLs
-### JSON Encoding Test
-
-http://localhost/json
-
-### Data-Store/Database Mapping Test
-
-http://localhost/db?queries=5

+ 0 - 0
frameworks/Java/play-java/__init__.py


+ 0 - 81
frameworks/Java/play-java/app/controllers/Application.java

@@ -1,81 +0,0 @@
-package controllers;
-
-import akka.dispatch.ExecutionContexts;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import models.World;
-import play.Play;
-import play.core.NamedThreadFactory;
-import play.libs.F;
-import play.libs.Json;
-
-import play.mvc.Controller;
-import play.mvc.Result;
-import scala.concurrent.ExecutionContext;
-import utils.Predicate;
-import utils.Predicated;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-import java.util.concurrent.*;
-
-public class Application extends Controller {
-
-    private static final int MAX_QUERIES_PER_REQUEST = 20;
-    private static final int TEST_DATABASE_ROWS = 10000;
-    //http://stackoverflow.com/questions/3907929/should-i-make-jacksons-objectmapper-as-static-final
-    private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
-
-    private static final int partitionCount = Play.application().configuration().getInt("db.default.partitionCount");
-    private static final int maxConnections =
-            partitionCount * Play.application().configuration().getInt("db.default.maxConnectionsPerPartition");
-    private static final int minConnections =
-            partitionCount * Play.application().configuration().getInt("db.default.minConnectionsPerPartition");
-
-    private static final ThreadPoolExecutor tpe = new ThreadPoolExecutor(minConnections, maxConnections,
-            0L, TimeUnit.MILLISECONDS,
-            new LinkedBlockingQueue<Runnable>(),
-            new NamedThreadFactory("dbEc"));
-    private static final ExecutionContext dbEc = ExecutionContexts.fromExecutorService(tpe);
-
-    // A predicate for checking our ability to service database requests is determined by ensuring that the request
-    // queue doesn't fill up beyond a certain threshold. For convenience we use the max number of connections * the max
-    // # of db requests per web request to determine this threshold. It is a rough check as we don't know how many
-    // queries we're going to make or what other threads are running in parallel etc. Nevertheless, the check is
-    // adequate in order to throttle the acceptance of requests to the size of the pool.
-    public static class IsDbAvailable implements Predicate {
-        @Override
-        public boolean condition() {
-            return tpe.getQueue().size() < maxConnections * MAX_QUERIES_PER_REQUEST;
-        }
-    }
-
-    public static Result json() {
-        final ObjectNode result = OBJECT_MAPPER.createObjectNode();
-        result.put("message", "Hello, World!");
-        return ok(result);
-    }
-
-    @Predicated(predicate = IsDbAvailable.class, failed = SERVICE_UNAVAILABLE)
-    public static F.Promise<Result> db(final Integer queries) {
-        final Random random = ThreadLocalRandom.current();
-        final List<F.Promise<? extends World>> promises = new ArrayList<F.Promise<? extends World>>(queries);
-        for (int i = 0; i < queries; ++i) {
-            final F.Promise<World> p = F.Promise.promise(new F.Function0<World>() {
-                @Override
-                public World apply() throws Throwable {
-                    return World.find.byId(Long.valueOf(random.nextInt(TEST_DATABASE_ROWS) + 1));
-                }
-            }, dbEc);
-            promises.add(p);
-        }
-        return F.Promise.sequence(promises).map(new F.Function<List<World>, Result>() {
-            @Override
-            public Result apply(List<World> worlds) {
-                return ok(Json.toJson(worlds));
-            }
-        });
-    }
-
-}

+ 0 - 20
frameworks/Java/play-java/app/models/World.java

@@ -1,20 +0,0 @@
-package models;
-
-import javax.persistence.*;
-
-import play.db.ebean.*;
-
-@Entity
-public class World extends Model {
-
-    @Id
-    public Long id;
-
-    @Column(name = "randomNumber")
-    public Long randomNumber;
-
-    public static Finder<Long, World> find = new Finder<Long, World>(
-            Long.class, World.class
-    );
-
-}

+ 0 - 8
frameworks/Java/play-java/app/utils/Predicate.java

@@ -1,8 +0,0 @@
-package utils;
-
-/**
- * Predicates for PredicatedActions.
- */
-public interface Predicate {
-    boolean condition();
-}

+ 0 - 26
frameworks/Java/play-java/app/utils/Predicated.java

@@ -1,26 +0,0 @@
-package utils;
-
-import play.mvc.With;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Declares a composing action that will check for a condition before deciding on whether to proceed with the request.
- */
-@With(PredicatedAction.class)
-@Target({ElementType.TYPE, ElementType.METHOD})
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Predicated {
-    /**
-     * The condition.
-     */
-    Class<? extends Predicate> predicate();
-
-    /**
-     * The http status code to return if the condition fails.
-     */
-    int failed();
-}

+ 0 - 23
frameworks/Java/play-java/app/utils/PredicatedAction.java

@@ -1,23 +0,0 @@
-package utils;
-
-/**
- * A predicated action is one where a condition must be satisfied in order to proceed with the request. If the
- * condition is not satisfied then a supplied status result is yielded.
- */
-
-import play.libs.F;
-import play.mvc.Action;
-import play.mvc.Http;
-import play.mvc.SimpleResult;
-
-public class PredicatedAction extends Action<Predicated> {
-    @Override
-    public F.Promise<SimpleResult> call(final Http.Context ctx) throws Throwable {
-        final Predicate p = configuration.predicate().newInstance();
-        if (p.condition()) {
-            return delegate.call(ctx);
-        } else {
-            return F.Promise.<SimpleResult>pure(status(configuration.failed()));
-        }
-    }
-}

+ 0 - 25
frameworks/Java/play-java/benchmark_config

@@ -1,25 +0,0 @@
-{
-  "framework": "play2",
-  "tests": [{
-    "default": {
-      "setup_file": "setup",
-      "json_url": "/json",
-      "db_url": "/db",
-      "query_url": "/db?queries=",
-      "port": 9000,
-      "approach": "Realistic",
-      "classification": "Fullstack",
-      "database": "MySQL",
-      "framework": "play2",
-      "language": "Java",
-      "orm": "Full",
-      "platform": "Netty",
-      "webserver": "None",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "play-java-ebean",
-      "notes": "",
-      "versus": "netty"
-    }
-  }]
-}

+ 0 - 13
frameworks/Java/play-java/build.sbt

@@ -1,13 +0,0 @@
-name := "play-java"
-
-version := "1.0-SNAPSHOT"
-
-libraryDependencies ++= Seq(
-  javaJdbc,
-  javaEbean,
-  "mysql" % "mysql-connector-java" % "5.1.22"
-  )
-
-dependencyOverrides += "com.jolbox" % "bonecp" % "0.7.1.RELEASE"
-
-playJavaSettings

+ 0 - 74
frameworks/Java/play-java/conf/application.conf

@@ -1,74 +0,0 @@
-# This is the main configuration file for the application.
-# ~~~~~
-
-# Secret key
-# ~~~~~
-# The secret key is used to secure cryptographics functions.
-# If you deploy your application to several instances be sure to use the same key!
-application.secret="RItx1I:80?W@]8GAtPDuF8Ydd3mXM85p/<7og]Q;uBOdijQAauRDgu73B6`wQP59"
-
-# The application languages
-# ~~~~~
-application.langs="en"
-
-# Global object class
-# ~~~~~
-# Define the Global object class for this application.
-# Default to Global in the root package.
-# global=Global
-
-# Database configuration
-# ~~~~~ 
-# You can declare as many datasources as you want.
-# By convention, the default datasource is named `default`
-#
-# db.default.driver=org.h2.Driver
-# db.default.url="jdbc:h2:mem:play"
-# db.default.user=sa
-# db.default.password=
-#
-# You can expose this datasource via JNDI if needed (Useful for JPA)
-# db.default.jndiName=DefaultDS
-db.default.driver= com.mysql.jdbc.Driver
-db.default.url="jdbc:mysql://localhost:3306/hello_world?jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=4096&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=false&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true"
-db.default.user=benchmarkdbuser
-db.default.password=benchmarkdbpass
-db.default.jndiName=DefaultDS
-
-db.default.partitionCount=4
-
-# The number of connections to create per partition. Setting this to 
-# 5 with 3 partitions means you will have 15 unique connections to the 
-# database. Note that BoneCP will not create all these connections in 
-# one go but rather start off with minConnectionsPerPartition and 
-# gradually increase connections as required.
-db.default.maxConnectionsPerPartition=64
-
-# The number of initial connections, per partition.
-db.default.minConnectionsPerPartition=64
-
-# Evolutions
-# ~~~~~
-# You can disable evolutions if needed
-# evolutionplugin=disabled
-
-# Ebean configuration
-# ~~~~~
-# You can declare as many Ebean servers as you want.
-# By convention, the default server is named `default`
-#
-ebean.default="models.*"
-
-# Logger
-# ~~~~~
-# You can also configure logback (http://logback.qos.ch/), by providing a logger.xml file in the conf directory .
-
-# Root logger:
-logger.root=ERROR
-
-# Logger used by the framework:
-logger.play=ERROR
-
-# Logger provided to your application:
-logger.application=ERROR
-

+ 0 - 10
frameworks/Java/play-java/conf/routes

@@ -1,10 +0,0 @@
-# Routes
-# This file defines all application routes (Higher priority routes first)
-# ~~~~
-
-# Home page
-GET     /json                           controllers.Application.json
-GET     /db                             controllers.Application.db(queries: Int ?= 1)
-
-# Map static resources from the /public folder to the /assets URL path
-GET     /assets/*file               controllers.Assets.at(path="/public", file)

+ 0 - 3
frameworks/Java/play-java/install.sh

@@ -1,3 +0,0 @@
-#!/bin/bash
-
-fw_depends play2 java

+ 0 - 1
frameworks/Java/play-java/project/build.properties

@@ -1 +0,0 @@
-sbt.version=0.13.0

+ 0 - 8
frameworks/Java/play-java/project/plugins.sbt

@@ -1,8 +0,0 @@
-// Comment to get more information during initialization
-logLevel := Level.Warn
-
-// The Typesafe repository 
-resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
-
-// Use the Play sbt plugin for Play projects
-addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.0")

+ 0 - 12
frameworks/Java/play-java/setup.py

@@ -1,12 +0,0 @@
-import setup_util
-import subprocess
-
-def start(args, logfile, errfile):
-  setup_util.replace_text("play-java/conf/application.conf", "jdbc:mysql:\/\/.*:3306", "jdbc:mysql://" + args.database_host + ":3306")
-  subprocess.Popen(["play","start"], stdin=subprocess.PIPE, cwd="play-java", stderr=errfile, stdout=logfile)
-  return 0
-
-def stop(logfile, errfile):
-  p = subprocess.Popen(["play","stop"], cwd="play-java", stderr=errfile, stdout=logfile)
-  p.communicate()
-  return 0

+ 0 - 9
frameworks/Java/play-java/source_code

@@ -1,9 +0,0 @@
-./play-java/app/
-./play-java/app/controllers
-./play-java/app/controllers/Application.java
-./play-java/app/utils
-./play-java/app/utils/Predicate.java
-./play-java/app/utils/PredicatedAction.java
-./play-java/app/utils/Predicated.java
-./play-java/app/models
-./play-java/app/models/World.java

+ 4 - 4
frameworks/Java/play2-java/README.md

@@ -1,5 +1,5 @@
-# play2 framework tests
+# play2-java framework tests
 
-1. Add new test applications in subdirectories named either `play2-language` or `play2-language-orm`.
-2. Edit `generate_config.py` and add configuration for the new test applications.
-3. Run `python generate_config.py` to generate a new `benchmark_config` file and to generate a `setup_play2_*.py` file for your test application.
+1. Add new test applications in subdirectories named either `play2-java` or `play2-java-orm`.
+2. Edit `frameworks/Java/play2-java/generate_config.py` and add configuration for the new test applications.
+3. Run `python frameworks/Java/play2-java/generate_config.py` to generate a new `benchmark_config` file and to generate a `setup_*.py` file for your test application.

+ 43 - 25
frameworks/Java/play2-java/generate_config.py

@@ -1,17 +1,17 @@
 #!/usr/bin/env python
 
-import collections, json, textwrap
+import collections, json, os, textwrap
 
 # This script generates the benchmark_config and setup_*.py files.
 # To add new tests, modify the `configurations` and `test_urls` tables.
 
 # Each line corresponds to a test application.
-# Format is: (language, orm, (os, ...), (test, ...))
+# Format is: (language, orm, (opsys, ...), (test, ...))
 # See the dir_name logic below to see the directory name for each test application.
 configurations = [
   ('Java',  None,    ['Linux'],            ['json']),
-  ('Scala', None,    ['Linux'],            ['json']),
   ('Java',  'Ebean', ['Linux'],            ['db', 'query']),
+  ('Scala', None,    ['Linux'],            ['json']),
   ('Scala', 'Anorm', ['Linux', 'Windows'], ['db', 'query', 'fortune', 'update']),
 ]
 
@@ -24,24 +24,47 @@ test_urls = {
   'update': '/update?queries=',
 }
 
-tests_config_json = collections.OrderedDict()
+langs = {
+  'Java': ['Java', 'play2-java'],
+  'Scala': ['Scala', 'play2-scala']
+}
+def pathForLang(lang):
+  return os.path.join(frameworksPath(), *langs[lang])
+def frameworksPath():
+  'Get the absolute path of ROOT/frameworks'
+  return os.path.abspath(os.path.join(__file__, '..', '..', '..'))
+
+lang_test_configs = {}
+for lang, _ in langs.iteritems():
+  lang_test_configs[lang] = collections.OrderedDict()
 
-for lang, orm, oses, tests in configurations:
+for lang, orm, opsyses, tests in configurations:
   dir_name = 'play2-' + lang.lower() + (('-'+orm.lower()) if orm else '')
-  print 'Generating tests for test application '+dir_name
   setup_name = 'setup_' + lang.lower() + (('_'+orm.lower()) if orm else '')
-  for os in oses:
-    if len(oses) == 1:
+
+  setup_path = os.path.join(pathForLang(lang), setup_name+'.py')
+  print 'Generating', setup_path
+  with open(setup_path, 'w') as f:
+    f.write(textwrap.dedent("""
+      # This file was generated by frameworks/Java/play2-java/generate_config.py.
+      # Do not edit this file directly, use the script to regenerate.
+      from .setup_common import make_setup_for_dir
+
+      make_setup_for_dir(globals(), '"""+dir_name+"""')
+    """))
+
+  for opsys in opsyses:
+    if len(opsyses) == 1:
       test_name = lang.lower() + (('-'+orm.lower()) if orm else '')
     else:
-      test_name = lang.lower() + (('-'+orm.lower()) if orm else '') + '-'+os.lower()
+      test_name = lang.lower() + (('-'+orm.lower()) if orm else '') + '-'+opsys.lower()
     test_config_json = collections.OrderedDict([
       ('display_name', 'play2-'+test_name),
       ('setup_file', setup_name),
       ('framework', 'play2'),
       ('language', lang),
       ('orm', orm if orm else 'Raw'),
-      ('os', os),
+      ('os', opsys),
       ('database', 'MySQL' if orm else 'None'),
       ('approach', 'Realistic'),
       ('classification', 'Fullstack'),
@@ -54,19 +77,14 @@ for lang, orm, oses, tests in configurations:
     ])
     for test in tests:
       test_config_json[test+'_url'] = test_urls[test]
-      tests_config_json[test_name] = test_config_json
-    with open(setup_name+'.py', 'w') as f:
-      f.write(textwrap.dedent("""
-        # This file was generated by generate_config.py.
-        # Do not edit this file directly.
-        from .setup_common import make_setup_for_dir
-
-        make_setup_for_dir(globals(), '"""+dir_name+"""')
-      """))
+      lang_test_configs[lang][test_name] = test_config_json
 
-with open('benchmark_config', 'w') as f:
-  json_str = json.dumps({
-    'framework': 'play2',
-    'tests': [tests_config_json]
-  }, indent=2)
-  f.write(json_str)
+for lang, _ in langs.iteritems():
+  benchmark_config_path = os.path.join(pathForLang(lang), 'benchmark_config')
+  print 'Generating', benchmark_config_path
+  with open(benchmark_config_path, 'w') as f:
+    json_str = json.dumps({
+      'framework': 'play2',
+      'tests': [lang_test_configs[lang]]
+    }, indent=2)
+    f.write(json_str)

+ 3 - 0
frameworks/Java/play2-java/setup_common.py

@@ -1,3 +1,6 @@
+# This file and frameworks/Scala/play2-java/setup_common.py are
+# duplicates and should be kept in sync.
+
 import os, setup_util, signal, subprocess
 
 # Create start and stop functions for the Play project with the given dir

+ 2 - 2
frameworks/Java/play2-java/setup_java.py

@@ -1,6 +1,6 @@
 
-# This file was generated by generate_config.py.
-# Do not edit this file directly.
+# This file was generated by frameworks/Java/play2-java/generate_config.py.
+# Do not edit this file directly, use the script to regenerate.
 from .setup_common import make_setup_for_dir
 
 make_setup_for_dir(globals(), 'play2-java')

+ 2 - 2
frameworks/Java/play2-java/setup_java_ebean.py

@@ -1,6 +1,6 @@
 
-# This file was generated by generate_config.py.
-# Do not edit this file directly.
+# This file was generated by frameworks/Java/play2-java/generate_config.py.
+# Do not edit this file directly, use the script to regenerate.
 from .setup_common import make_setup_for_dir
 
 make_setup_for_dir(globals(), 'play2-java-ebean')

+ 22 - 0
frameworks/PHP/README.md

@@ -0,0 +1,22 @@
+# Tricks to writing PHP-based Frameworks
+
+Many servers use the `php`, `php-fpm`, or other binaries. If your
+server launches with `sudo` (e.g. `sudo php-fpm`) then you should be 
+aware that using sudo resets the `$PATH` environment variable, and your 
+specific binary may not be the one being used. The solution is to 
+always use `sudo <full-path-to-my-binary>`. For example, `cakephp`'s
+`bash_profile.sh` sets the variable `$PHP_FPM` to be the full path 
+to the `php-fpm` binary that `cakephp` wants, and then uses `sudo $PHP_FPM`
+to ensure that the `php-fpm` binary used by sudo is the exact binary 
+desired. 
+
+# Dependency Management
+
+Many PHP apps use https://getcomposer.org/ for dependency management.
+To support this, use `fw_depends php composer` (note that order is 
+important, composer requires php and therefore should be listed after
+PHP), and then add `$IROOT/php-composer` to the `PATH` in your `bash_profile.sh`. 
+For example: 
+
+    export COMPOSER_HOME=${IROOT}/php-composer
+    export PATH="$COMPOSER_HOME:$PATH"

+ 7 - 0
frameworks/PHP/hhvm/bash_profile.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export PATH="$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 1 - 1
frameworks/PHP/hhvm/install.sh

@@ -1,3 +1,3 @@
 #!/bin/bash
 
-fw_depends hhvm php
+fw_depends php hhvm

+ 6 - 10
frameworks/PHP/hhvm/setup.py

@@ -2,23 +2,19 @@
 import subprocess
 import setup_util
 import os
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("hhvm/once.php.inc", "host=localhost;", "host=" + args.database_host + ";")
-  setup_util.replace_text("hhvm/deploy/config.hdf", "SourceRoot = .*\/FrameworkBenchmarks", "SourceRoot = " + home + "/FrameworkBenchmarks")
-  setup_util.replace_text("hhvm/deploy/config.hdf", "Path = .*\/.hhvm.hhbc", "Path = " + home + "/FrameworkBenchmarks/hhvm/.hhvm.bbhc")
-  setup_util.replace_text("hhvm/deploy/config.hdf", "PidFile = .*\/hhvm.pid", "PidFile = " + home + "/FrameworkBenchmarks/hhvm/hhvm.pid")
-  setup_util.replace_text("hhvm/deploy/config.hdf", "File = .*\/error.log", "File = " + home + "/FrameworkBenchmarks/hhvm/error.log")
-
+  setup_util.replace_text("hhvm/deploy/config.hdf", "SourceRoot = .*\/FrameworkBenchmarks/hhvm", "SourceRoot = " + args.troot)
+  setup_util.replace_text("hhvm/deploy/config.hdf", "Path = .*\/.hhvm.hhbc", "Path = " + args.troot + "/.hhvm.bbhc")
+  setup_util.replace_text("hhvm/deploy/config.hdf", "PidFile = .*\/hhvm.pid", "PidFile = " + args.troot + "/hhvm.pid")
+  setup_util.replace_text("hhvm/deploy/config.hdf", "File = .*\/error.log", "File = " + args.troot + "/error.log")
 
   try:
     if os.name == 'nt':
       # Not supported !
       return 0
-    subprocess.check_call("hhvm --config " + home + "/FrameworkBenchmarks/hhvm/deploy/config.hdf -m daemon", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("hhvm --config $TROOT/deploy/config.hdf -m daemon", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1
@@ -30,7 +26,7 @@ def stop(logfile, errfile):
     p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
     out, err = p.communicate()
     for line in out.splitlines():
-      if 'hhvm' in line and 'toolset' not in line:
+      if 'hhvm' in line and 'toolset' not in line and 'run-ci' not in line and 'run-tests' not in line:
         pid = int(line.split(None,2)[1])
         os.kill(pid,15)
     return 0

+ 7 - 0
frameworks/PHP/php-codeigniter/bash_profile.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export PATH="$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 4 - 7
frameworks/PHP/php-codeigniter/setup.py

@@ -2,13 +2,10 @@ import subprocess
 import sys
 import setup_util
 import os
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php-codeigniter/application/config/database.php", "localhost", ""+ args.database_host +"")
-  setup_util.replace_text("php-codeigniter/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-codeigniter/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-codeigniter", "root " + args.troot)
 
   try:
     if os.name == 'nt':
@@ -16,8 +13,8 @@ def start(args, logfile, errfile):
       subprocess.check_call('appcmd add site /name:PHP /bindings:http/*:8080: /physicalPath:"C:\\FrameworkBenchmarks\\php-codeigniter"', shell=True, stderr=errfile, stdout=logfile)
       return 0
     subprocess.check_call("sudo chown -R www-data:www-data php-codeigniter", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-codeigniter/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-codeigniter/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1
@@ -27,7 +24,7 @@ def stop(logfile, errfile):
       subprocess.call('appcmd delete site PHP', shell=True, stderr=errfile, stdout=logfile)
       return 0
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat php-codeigniter/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
     subprocess.check_call("sudo chown -R $USER:$USER php-codeigniter", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:

+ 7 - 0
frameworks/PHP/php-fatfree/bash_profile.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export PATH="$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 3 - 0
frameworks/PHP/php-fatfree/install.sh

@@ -0,0 +1,3 @@
+#!/bin/bash
+
+fw_depends php nginx

+ 7 - 10
frameworks/PHP/php-fatfree/setup.py

@@ -3,15 +3,12 @@ import subprocess
 import sys
 import setup_util
 import os
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php-fatfree/index.php", "localhost", ""+ args.database_host +"")
-  setup_util.replace_text("php-fatfree/deploy/php", "\".*\/FrameworkBenchmarks", "\"" + home + "/FrameworkBenchmarks")
-  setup_util.replace_text("php-fatfree/deploy/php", "Directory .*\/FrameworkBenchmarks", "Directory " + home + "/FrameworkBenchmarks")
-  setup_util.replace_text("php-fatfree/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-fatfree/deploy/php", "\".*\/FrameworkBenchmarks/php-fatfree", "\"" + args.troot)
+  setup_util.replace_text("php-fatfree/deploy/php", "Directory .*\/FrameworkBenchmarks/php-fatfree", "Directory " + args.troot)
+  setup_util.replace_text("php-fatfree/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-fatfree", "root " + args.troot)
   
   try:
     if os.name == 'nt':
@@ -23,9 +20,9 @@ def start(args, logfile, errfile):
     #subprocess.check_call("sudo /etc/init.d/apache2 start", shell=True)
 
     subprocess.check_call("sudo chown -R www-data:www-data php-fatfree", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo chmod -R 775 " + home + "/FrameworkBenchmarks/php-fatfree/tmp/", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-fatfree/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-fatfree/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo chmod -R 775 $TROOT/tmp/", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     
     return 0
   except subprocess.CalledProcessError:
@@ -37,7 +34,7 @@ def stop(logfile, errfile):
       return 0
     
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat php-fatfree/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
     subprocess.check_call("sudo chown -R $USER:$USER php-fatfree", shell=True, stderr=errfile, stdout=logfile)
 
     return 0

+ 7 - 0
frameworks/PHP/php-fuel/bash_profile.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export PATH="$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 4 - 7
frameworks/PHP/php-fuel/setup.py

@@ -2,13 +2,10 @@ import subprocess
 import sys
 import os
 import setup_util
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php-fuel/fuel/app/config/production/db.php", "localhost", ""+ args.database_host +"")
-  setup_util.replace_text("php-fuel/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-fuel/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-fuel", "root " + args.troot)
 
   try:
     if os.name == 'nt':
@@ -16,8 +13,8 @@ def start(args, logfile, errfile):
       subprocess.check_call('appcmd add site /name:PHP /bindings:http/*:8080: /physicalPath:"C:\\FrameworkBenchmarks\\php-fuel"', shell=True, stderr=errfile, stdout=logfile)
       return 0
     subprocess.check_call("sudo chown -R www-data:www-data php-fuel", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-fuel/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-fuel/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1
@@ -27,7 +24,7 @@ def stop(logfile, errfile):
       subprocess.call('appcmd delete site PHP', shell=True, stderr=errfile, stdout=logfile)
       return 0
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat php-fuel/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
     subprocess.check_call("sudo chown -R $USER:$USER php-fuel", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:

+ 7 - 0
frameworks/PHP/php-kohana/bash_profile.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export PATH="$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 4 - 7
frameworks/PHP/php-kohana/setup.py

@@ -2,13 +2,10 @@ import subprocess
 import sys
 import setup_util
 import os
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php-kohana/application/config/database.php", "localhost", ""+ args.database_host +"")
-  setup_util.replace_text("php-kohana/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-kohana/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-kohana", "root " + args.troot)
 
   try:
     if os.name == 'nt':
@@ -16,8 +13,8 @@ def start(args, logfile, errfile):
       subprocess.check_call('appcmd add site /name:PHP /bindings:http/*:8080: /physicalPath:"C:\\FrameworkBenchmarks\\php-kohana"', shell=True, stderr=errfile, stdout=logfile)
       return 0
     subprocess.check_call("sudo chown -R www-data:www-data php-kohana", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-kohana/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-kohana/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1
@@ -27,7 +24,7 @@ def stop(logfile, errfile):
       subprocess.check_call('appcmd delete site PHP', shell=True, stderr=errfile, stdout=logfile)
       return 0
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat php-kohana/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
     subprocess.check_call("sudo chown -R $USER:$USER php-kohana", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:

+ 7 - 0
frameworks/PHP/php-laravel/bash_profile.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export PATH="$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 4 - 7
frameworks/PHP/php-laravel/setup.py

@@ -2,13 +2,10 @@ import subprocess
 import sys
 import os
 import setup_util
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php-laravel/application/config/database.php", "localhost", ""+ args.database_host +"")
-  setup_util.replace_text("php-laravel/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-laravel/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-laravel", "root " + args.troot)
 
   try:
     if os.name == 'nt':
@@ -16,8 +13,8 @@ def start(args, logfile, errfile):
       subprocess.check_call('appcmd add site /name:PHP /bindings:http/*:8080: /physicalPath:"C:\\FrameworkBenchmarks\\php-laravel\\public"', shell=True, stderr=errfile, stdout=logfile)
       return 0
     subprocess.check_call("sudo chown -R www-data:www-data php-laravel", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-laravel/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-laravel/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1
@@ -27,7 +24,7 @@ def stop(logfile, errfile):
       subprocess.call('appcmd delete site PHP', shell=True, stderr=errfile, stdout=logfile)
       return 0
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat php-laravel/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
     subprocess.check_call("sudo chown -R $USER:$USER php-laravel", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:

+ 7 - 0
frameworks/PHP/php-lithium/bash_profile.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export PATH="$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 4 - 7
frameworks/PHP/php-lithium/setup.py

@@ -2,13 +2,10 @@ import subprocess
 import sys
 import os
 import setup_util
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php-lithium/app/config/bootstrap/connections.php", "192.168.100.102", ""+ args.database_host +"")
-  setup_util.replace_text("php-lithium/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-lithium/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-lithium", "root " + args.troot)
 
   try:
     if os.name == 'nt':
@@ -16,8 +13,8 @@ def start(args, logfile, errfile):
       subprocess.check_call('appcmd add site /name:PHP /bindings:http/*:8080: /physicalPath:"C:\\FrameworkBenchmarks\\php-lithium"', shell=True, stderr=errfile, stdout=logfile)
       return 0
     subprocess.check_call("sudo chown -R www-data:www-data php-lithium", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-lithium/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-lithium/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1
@@ -27,7 +24,7 @@ def stop(logfile, errfile):
       subprocess.call('appcmd delete site PHP', shell=True, stderr=errfile, stdout=logfile)
       return 0
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat php-lithium/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
     subprocess.check_call("sudo chown -R $USER:$USER php-lithium", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:

+ 7 - 0
frameworks/PHP/php-micromvc/bash_profile.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export PATH="$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 4 - 7
frameworks/PHP/php-micromvc/setup.py

@@ -2,13 +2,10 @@ import subprocess
 import sys
 import os
 import setup_util
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php-micromvc/Config/Config.php", "localhost", ""+ args.database_host +"")
-  setup_util.replace_text("php-micromvc/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-micromvc/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-micromvc", "root " + args.troot)
 
   try:
     if os.name == 'nt':
@@ -16,8 +13,8 @@ def start(args, logfile, errfile):
       subprocess.check_call('appcmd add site /name:PHP /bindings:http/*:8080: /physicalPath:"C:\\FrameworkBenchmarks\\php-micromvc\Public"', shell=True, stderr=errfile, stdout=logfile)
       return 0
     subprocess.check_call("sudo chown -R www-data:www-data php-micromvc", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-micromvc/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-micromvc/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1
@@ -27,7 +24,7 @@ def stop(logfile, errfile):
       subprocess.call('appcmd delete site PHP', shell=True, stderr=errfile, stdout=logfile)
       return 0
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat php-micromvc/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
     subprocess.check_call("sudo chown -R $USER:$USER php-micromvc", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:

+ 7 - 0
frameworks/PHP/php-phalcon-micro/bash_profile.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export PATH="$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 4 - 7
frameworks/PHP/php-phalcon-micro/setup.py

@@ -1,25 +1,22 @@
 import subprocess
 import sys
 import setup_util
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php-phalcon-micro/public/index.php", "localhost", ""+ args.database_host +"")
-  setup_util.replace_text("php-phalcon-micro/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-phalcon-micro/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-phalcon-micro", "root " + args.troot)
 
   try:
     subprocess.check_call("sudo chown -R www-data:www-data php-phalcon-micro", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-phalcon-micro/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-phalcon-micro/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1
 def stop(logfile, errfile):
   try:
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat php-phalcon-micro/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
     subprocess.check_call("sudo chown -R $USER:$USER php-phalcon-micro", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:

+ 7 - 0
frameworks/PHP/php-phalcon/bash_profile.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export PATH="$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 4 - 7
frameworks/PHP/php-phalcon/setup.py

@@ -1,26 +1,23 @@
 import subprocess
 import sys
 import setup_util
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php-phalcon/app/config/config.php", "mongodb:\/\/localhost", "mongodb://" + args.database_host)
   setup_util.replace_text("php-phalcon/app/config/config.php", "localhost", ""+ args.database_host +"")
-  setup_util.replace_text("php-phalcon/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-phalcon/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-phalcon", "root " + args.troot)
 
   try:
     subprocess.check_call("sudo chown -R www-data:www-data php-phalcon", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-phalcon/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-phalcon/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1
 def stop(logfile, errfile):
   try:
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat php-phalcon/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
     subprocess.check_call("sudo chown -R $USER:$USER php-phalcon", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:

+ 9 - 0
frameworks/PHP/php-phpixie/bash_profile.sh

@@ -0,0 +1,9 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export COMPOSER_HOME=${IROOT}/php-composer
+
+export PATH="$COMPOSER_HOME:$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 1 - 1
frameworks/PHP/php-phpixie/install.sh

@@ -1 +1 @@
-#!/bin/bash

fw_depends php nginx
+#!/bin/bash

fw_depends php composer nginx

+ 7 - 10
frameworks/PHP/php-phpixie/setup.py

@@ -1,27 +1,24 @@
 import subprocess
 import sys
 import setup_util
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php-phpixie/assets/config/db.php", "localhost", "" + args.database_host + "")
-  setup_util.replace_text("php-phpixie/deploy/php-phpixie", "\".*\/FrameworkBenchmarks", "\"" + home + "/FrameworkBenchmarks")
-  setup_util.replace_text("php-phpixie/deploy/php-phpixie", "Directory .*\/FrameworkBenchmarks", "Directory " + home + "/FrameworkBenchmarks")
-  setup_util.replace_text("php-phpixie/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-phpixie/deploy/php-phpixie", "\".*\/FrameworkBenchmarks/php-phpixie", "\"" + args.troot)
+  setup_util.replace_text("php-phpixie/deploy/php-phpixie", "Directory .*\/FrameworkBenchmarks/php-phpixie", "Directory " + args.troot)
+  setup_util.replace_text("php-phpixie/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-phpixie", "root " + args.troot)
 
   try:
     subprocess.check_call("composer.phar install --optimize-autoloader", shell=True, cwd="php-phpixie", stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-phpixie/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-phpixie/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1
 def stop(logfile, errfile):
   try:
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat php-phpixie/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
-    return 1
+    return 1

+ 9 - 0
frameworks/PHP/php-pimf/bash_profile.sh

@@ -0,0 +1,9 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export COMPOSER_HOME=${IROOT}/php-composer
+
+export PATH="$COMPOSER_HOME:$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 1 - 1
frameworks/PHP/php-pimf/install.sh

@@ -1,3 +1,3 @@
 #!/bin/bash
 
-fw_depends php nginx
+fw_depends php composer nginx

+ 6 - 9
frameworks/PHP/php-pimf/setup.py

@@ -1,15 +1,12 @@
 import subprocess
 import sys
 import setup_util
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php-pimf/app/config.app.php", "127.0.0.1", "" + args.database_host + "")
-  setup_util.replace_text("php-pimf/deploy/php-pimf", "\".*\/FrameworkBenchmarks", "\"" + home + "/FrameworkBenchmarks")
-  setup_util.replace_text("php-pimf/deploy/php-pimf", "Directory .*\/FrameworkBenchmarks", "Directory " + home + "/FrameworkBenchmarks")
-  setup_util.replace_text("php-pimf/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-pimf/deploy/php-pimf", "\".*\/FrameworkBenchmarks/php-pimf", "\"" + args.troot)
+  setup_util.replace_text("php-pimf/deploy/php-pimf", "Directory .*\/FrameworkBenchmarks/php-pimf", "Directory " + args.troot)
+  setup_util.replace_text("php-pimf/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-pimf", "root " + args.troot)
 
   try:
     #subprocess.check_call("sudo cp cake/deploy/cake /etc/apache2/sites-available/", shell=True)
@@ -17,15 +14,15 @@ def start(args, logfile, errfile):
     #subprocess.check_call("sudo chown -R www-data:www-data cake", shell=True)
     #subprocess.check_call("sudo /etc/init.d/apache2 start", shell=True)
     subprocess.check_call("composer.phar install --optimize-autoloader", shell=True, cwd="php-pimf")        
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-pimf/deploy/php-fpm.pid", shell=True)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-pimf/deploy/nginx.conf", shell=True)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True)
     return 0
   except subprocess.CalledProcessError:
     return 1
 def stop(logfile, errfile):
   try:
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True)
-    subprocess.call("sudo kill -QUIT $( cat php-pimf/deploy/php-fpm.pid )", shell=True)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True)
     #subprocess.check_call("sudo a2dissite cake", shell=True)
     #subprocess.check_call("sudo /etc/init.d/apache2 stop", shell=True)
     #subprocess.check_call("sudo chown -R $USER:$USER cake", shell=True)    

+ 6 - 9
frameworks/PHP/php-pimf/setup_raw.py

@@ -1,20 +1,17 @@
 import subprocess
 import sys
 import setup_util
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php-pimf/app/config.app.php", "127.0.0.1", "" + args.database_host + "")
-  setup_util.replace_text("php-pimf/deploy/php-pimf", "\".*\/FrameworkBenchmarks", "\"" + home + "/FrameworkBenchmarks")
-  setup_util.replace_text("php-pimf/deploy/php-pimf", "Directory .*\/FrameworkBenchmarks", "Directory " + home + "/FrameworkBenchmarks")
-  setup_util.replace_text("php-pimf/deploy/nginx_raw.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-pimf/deploy/php-pimf", "\".*\/FrameworkBenchmarks/php-pimf", "\"" + args.troot)
+  setup_util.replace_text("php-pimf/deploy/php-pimf", "Directory .*\/FrameworkBenchmarks/php-pimf", "Directory " + args.troot)
+  setup_util.replace_text("php-pimf/deploy/nginx_raw.conf", "root .*\/FrameworkBenchmarks/php-pimf", "root " + args.troot)
 
   try:
     subprocess.check_call("composer.phar install --optimize-autoloader", shell=True, cwd="php-pimf")
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-pimf/deploy/php-fpm.pid", shell=True)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-pimf/deploy/nginx_raw.conf", shell=True)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx_raw.conf", shell=True)
     return 0
   except subprocess.CalledProcessError:
     return 1
@@ -22,7 +19,7 @@ def start(args, logfile, errfile):
 def stop(logfile, errfile):
   try:
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True)
-    subprocess.call("sudo kill -QUIT $( cat php-pimf/deploy/php-fpm.pid )", shell=True)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True)
     return 0
   except subprocess.CalledProcessError:
     return 1

+ 7 - 0
frameworks/PHP/php-senthot/bash_profile.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export PATH="$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 4 - 7
frameworks/PHP/php-senthot/setup.py

@@ -1,18 +1,15 @@
 import subprocess
 import sys
 import setup_util
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php-senthot/app/Conf/config.php", "'DB_HOST' => 'localhost'", "'DB_HOST' => '" + args.database_host +"'")
-  setup_util.replace_text("php-senthot/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-senthot/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-senthot", "root " + args.troot)
 
   try:
     subprocess.check_call("sudo chown -R www-data:www-data php-senthot", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-senthot/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-senthot/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1
@@ -20,7 +17,7 @@ def start(args, logfile, errfile):
 def stop(logfile, errfile):
   try:
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat php-senthot/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
     subprocess.check_call("sudo chown -R $USER:$USER php-senthot", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:

+ 9 - 0
frameworks/PHP/php-silex-orm/bash_profile.sh

@@ -0,0 +1,9 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export COMPOSER_HOME=${IROOT}/php-composer
+
+export PATH="$COMPOSER_HOME:$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 1 - 1
frameworks/PHP/php-silex-orm/install.sh

@@ -1,3 +1,3 @@
 #!/bin/bash
 
-fw_depends php nginx
+fw_depends php composer nginx

+ 6 - 9
frameworks/PHP/php-silex-orm/setup.py

@@ -2,15 +2,12 @@
 import subprocess
 import sys
 import setup_util
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php-silex-orm/web/index.php", "192.168.100.102", "" + args.database_host + "")
-  setup_util.replace_text("php-silex-orm/deploy/php-silex-orm", "\".*\/FrameworkBenchmarks", "\"" + home + "/FrameworkBenchmarks")
-  setup_util.replace_text("php-silex-orm/deploy/php-silex-orm", "Directory .*\/FrameworkBenchmarks", "Directory " + home + "/FrameworkBenchmarks")
-  setup_util.replace_text("php-silex-orm/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-silex-orm/deploy/php-silex-orm", "\".*\/FrameworkBenchmarks/php-silex-orm", "\"" + args.troot)
+  setup_util.replace_text("php-silex-orm/deploy/php-silex-orm", "Directory .*\/FrameworkBenchmarks/php-silex-orm", "Directory " + args.troot)
+  setup_util.replace_text("php-silex-orm/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-silex-orm", "root " + args.troot)
 
   try:
     #subprocess.check_call("sudo cp cake/deploy/cake /etc/apache2/sites-available/", shell=True)
@@ -18,15 +15,15 @@ def start(args, logfile, errfile):
     #subprocess.check_call("sudo chown -R www-data:www-data cake", shell=True)
     #subprocess.check_call("sudo /etc/init.d/apache2 start", shell=True)
     subprocess.check_call("composer.phar install", shell=True, cwd="php-silex-orm", stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-silex-orm/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-silex-orm/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1
 def stop(logfile, errfile):
   try:
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat php-silex-orm/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
     #subprocess.check_call("sudo a2dissite cake", shell=True)
     #subprocess.check_call("sudo /etc/init.d/apache2 stop", shell=True)
     #subprocess.check_call("sudo chown -R $USER:$USER cake", shell=True)

+ 9 - 0
frameworks/PHP/php-silex/bash_profile.sh

@@ -0,0 +1,9 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export COMPOSER_HOME=${IROOT}/php-composer
+
+export PATH="$COMPOSER_HOME:$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 1 - 1
frameworks/PHP/php-silex/install.sh

@@ -1,3 +1,3 @@
 #!/bin/bash
 
-fw_depends php nginx
+fw_depends php composer nginx

+ 6 - 9
frameworks/PHP/php-silex/setup.py

@@ -1,15 +1,12 @@
 import subprocess
 import sys
 import setup_util
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php-silex/web/index.php", "192.168.100.102", "" + args.database_host + "")
-  setup_util.replace_text("php-silex/deploy/php-silex", "\".*\/FrameworkBenchmarks", "\"" + home + "/FrameworkBenchmarks")
-  setup_util.replace_text("php-silex/deploy/php-silex", "Directory .*\/FrameworkBenchmarks", "Directory " + home + "/FrameworkBenchmarks")
-  setup_util.replace_text("php-silex/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-silex/deploy/php-silex", "\".*\/FrameworkBenchmarks/php-silex", "\"" + args.troot)
+  setup_util.replace_text("php-silex/deploy/php-silex", "Directory .*\/FrameworkBenchmarks/php-silex", "Directory " + args.troot)
+  setup_util.replace_text("php-silex/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-silex", "root " + args.troot)
 
   try:
     #subprocess.check_call("sudo cp cake/deploy/cake /etc/apache2/sites-available/", shell=True)
@@ -17,15 +14,15 @@ def start(args, logfile, errfile):
     #subprocess.check_call("sudo chown -R www-data:www-data cake", shell=True)
     #subprocess.check_call("sudo /etc/init.d/apache2 start", shell=True)
     subprocess.check_call("composer.phar install --optimize-autoloader", shell=True, cwd="php-silex", stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-silex/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-silex/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1
 def stop(logfile, errfile):
   try:
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat php-silex/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
     #subprocess.check_call("sudo a2dissite cake", shell=True)
     #subprocess.check_call("sudo /etc/init.d/apache2 stop", shell=True)
     #subprocess.check_call("sudo chown -R $USER:$USER cake", shell=True)    

+ 6 - 9
frameworks/PHP/php-silex/setup_raw.py

@@ -1,20 +1,17 @@
 import subprocess
 import sys
 import setup_util
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php-silex/web/index_raw.php", "192.168.100.102", "" + args.database_host + "")
-  setup_util.replace_text("php-silex/deploy/php-silex", "\".*\/FrameworkBenchmarks", "\"" + home + "/FrameworkBenchmarks")
-  setup_util.replace_text("php-silex/deploy/php-silex", "Directory .*\/FrameworkBenchmarks", "Directory " + home + "/FrameworkBenchmarks")
-  setup_util.replace_text("php-silex/deploy/nginx_raw.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-silex/deploy/php-silex", "\".*\/FrameworkBenchmarks/php-silex", "\"" + args.troot)
+  setup_util.replace_text("php-silex/deploy/php-silex", "Directory .*\/FrameworkBenchmarks/php-silex", "Directory " + args.troot)
+  setup_util.replace_text("php-silex/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-silex", "root " + args.troot)
 
   try:
     subprocess.check_call("composer.phar install --optimize-autoloader", shell=True, cwd="php-silex", stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-silex/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-silex/deploy/nginx_raw.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx_raw.conf", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1
@@ -22,7 +19,7 @@ def start(args, logfile, errfile):
 def stop(logfile, errfile):
   try:
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat php-silex/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1

+ 9 - 0
frameworks/PHP/php-silica/bash_profile.sh

@@ -0,0 +1,9 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export COMPOSER_HOME=${IROOT}/php-composer
+
+export PATH="$COMPOSER_HOME:$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 1 - 1
frameworks/PHP/php-silica/install.sh

@@ -1,3 +1,3 @@
 #!/bin/bash
 
-fw_depends php nginx
+fw_depends php composer nginx

+ 6 - 9
frameworks/PHP/php-silica/setup.py

@@ -2,15 +2,12 @@
 import subprocess
 import sys
 import setup_util
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php-silica/web/app.php", "192.168.100.102", "" + args.database_host + "")
-  setup_util.replace_text("php-silica/deploy/php-silica", "\".*\/FrameworkBenchmarks", "\"" + home + "/FrameworkBenchmarks")
-  setup_util.replace_text("php-silica/deploy/php-silica", "Directory .*\/FrameworkBenchmarks", "Directory " + home + "/FrameworkBenchmarks")
-  setup_util.replace_text("php-silica/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-silica/deploy/php-silica", "\".*\/FrameworkBenchmarks/php-silica", "\"" + args.troot)
+  setup_util.replace_text("php-silica/deploy/php-silica", "Directory .*\/FrameworkBenchmarks/php-silica", "Directory " + args.troot)
+  setup_util.replace_text("php-silica/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-silica", "root " + args.troot)
 
   try:
     #subprocess.check_call("sudo cp cake/deploy/cake /etc/apache2/sites-available/", shell=True)
@@ -18,15 +15,15 @@ def start(args, logfile, errfile):
     #subprocess.check_call("sudo chown -R www-data:www-data cake", shell=True)
     #subprocess.check_call("sudo /etc/init.d/apache2 start", shell=True)
     subprocess.check_call("composer.phar install", shell=True, cwd="php-silica", stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-silica/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-silica/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1
 def stop(logfile, errfile):
   try:
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat php-silica/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
     #subprocess.check_call("sudo a2dissite cake", shell=True)
     #subprocess.check_call("sudo /etc/init.d/apache2 stop", shell=True)
     #subprocess.check_call("sudo chown -R $USER:$USER cake", shell=True)    

+ 7 - 0
frameworks/PHP/php-slim/bash_profile.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export PATH="$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 4 - 7
frameworks/PHP/php-slim/setup.py

@@ -2,13 +2,10 @@ import subprocess
 import sys
 import os
 import setup_util
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php-slim/index.php", "localhost", ""+ args.database_host +"")
-  setup_util.replace_text("php-slim/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-slim/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-slim", "root " + args.troot)
 
   try:
     if os.name == 'nt':
@@ -16,8 +13,8 @@ def start(args, logfile, errfile):
       subprocess.check_call('appcmd add site /name:PHP /bindings:http/*:8080: /physicalPath:"C:\\FrameworkBenchmarks\\php-slim"', shell=True, stderr=errfile, stdout=logfile)
       return 0
     subprocess.check_call("sudo chown -R www-data:www-data php-slim", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-slim/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-slim/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1
@@ -27,7 +24,7 @@ def stop(logfile, errfile):
       subprocess.call('appcmd delete site PHP', shell=True, stderr=errfile, stdout=logfile)
       return 0
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat php-slim/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
     subprocess.check_call("sudo chown -R $USER:$USER php-slim", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:

+ 9 - 0
frameworks/PHP/php-symfony2-stripped/bash_profile.sh

@@ -0,0 +1,9 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export COMPOSER_HOME=${IROOT}/php-composer
+
+export PATH="$COMPOSER_HOME:$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 1 - 1
frameworks/PHP/php-symfony2-stripped/install.sh

@@ -1,3 +1,3 @@
 #!/bin/bash
 
-fw_depends php nginx
+fw_depends php composer nginx

+ 4 - 7
frameworks/PHP/php-symfony2-stripped/setup.py

@@ -1,28 +1,25 @@
 import subprocess
 import sys
 import setup_util
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php-symfony2/app/config/parameters.yml", "database_host: .*", "database_host: " + args.database_host)
-  setup_util.replace_text("php-symfony2/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-symfony2/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-symfony2", "root " + args.troot)
 
   try:
     subprocess.check_call("composer.phar install --optimize-autoloader", shell=True, cwd="php-symfony2", stderr=errfile, stdout=logfile)
     subprocess.check_call("php app/console cache:clear --env=prod --no-debug", shell=True, cwd="php-symfony2", stderr=errfile, stdout=logfile)
     subprocess.check_call("php app/console cache:warmup --env=prod --no-debug", shell=True, cwd="php-symfony2", stderr=errfile, stdout=logfile)
     subprocess.check_call("sudo chown -R www-data:www-data php-symfony2", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-symfony2/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-symfony2/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1
 def stop(logfile, errfile):
   try:
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat php-symfony2/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
     subprocess.check_call("sudo chown -R $USER:$USER php-symfony2", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:

+ 9 - 0
frameworks/PHP/php-symfony2/bash_profile.sh

@@ -0,0 +1,9 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export COMPOSER_HOME=${IROOT}/php-composer
+
+export PATH="$COMPOSER_HOME:$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 1 - 1
frameworks/PHP/php-symfony2/install.sh

@@ -1,3 +1,3 @@
 #!/bin/bash
 
-fw_depends php nginx
+fw_depends php composer nginx

+ 4 - 7
frameworks/PHP/php-symfony2/setup.py

@@ -1,28 +1,25 @@
 import subprocess
 import sys
 import setup_util
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php-symfony2/app/config/parameters.yml", "database_host: .*", "database_host: " + args.database_host)
-  setup_util.replace_text("php-symfony2/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-symfony2/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-symfony2", "root " + args.troot)
 
   try:
     subprocess.check_call("composer.phar install --optimize-autoloader", shell=True, cwd="php-symfony2", stderr=errfile, stdout=logfile)
     subprocess.check_call("php app/console cache:clear --env=prod --no-debug", shell=True, cwd="php-symfony2", stderr=errfile, stdout=logfile)
     subprocess.check_call("php app/console cache:warmup --env=prod --no-debug", shell=True, cwd="php-symfony2", stderr=errfile, stdout=logfile)
     subprocess.check_call("sudo chown -R www-data:www-data php-symfony2", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-symfony2/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-symfony2/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1
 def stop(logfile, errfile):
   try:
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat php-symfony2/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
     subprocess.check_call("sudo chown -R $USER:$USER php-symfony2", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:

+ 7 - 0
frameworks/PHP/php-yaf/bash_profile.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export PATH="$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 4 - 7
frameworks/PHP/php-yaf/setup.py

@@ -1,18 +1,15 @@
 import subprocess
 import sys
 import setup_util
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php-yaf/app/conf/application.ini", "host=localhost", "host="+ args.database_host +"")
-  setup_util.replace_text("php-yaf/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-yaf/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-yaf", "root " + args.troot)
 
   try:
     subprocess.check_call("sudo chown -R www-data:www-data php-yaf", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-yaf/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-yaf/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1
@@ -20,7 +17,7 @@ def start(args, logfile, errfile):
 def stop(logfile, errfile):
   try:
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat php-yaf/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
     subprocess.check_call("sudo chown -R $USER:$USER php-yaf", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:

+ 7 - 0
frameworks/PHP/php-yii2/bash_profile.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export PATH="$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 4 - 7
frameworks/PHP/php-yii2/setup.py

@@ -2,13 +2,10 @@ import subprocess
 import sys
 import os
 import setup_util
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php-yii2/app/index.php", "localhost", ""+ args.database_host +"")
-  setup_util.replace_text("php-yii2/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-yii2/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-yii2", "root " + args.troot)
 
   try:
     if os.name == 'nt':
@@ -16,8 +13,8 @@ def start(args, logfile, errfile):
       subprocess.check_call('appcmd add site /name:PHP /bindings:http/*:8080: /physicalPath:"C:\\FrameworkBenchmarks\\php-yii2\\app"', shell=True, stderr=errfile, stdout=logfile)
       return 0
     subprocess.check_call("sudo chown -R www-data:www-data php-yii2", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-yii2/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-yii2/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1
@@ -27,7 +24,7 @@ def stop(logfile, errfile):
       subprocess.call('appcmd delete site PHP', shell=True, stderr=errfile, stdout=logfile)
       return 0
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat php-yii2/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
     subprocess.check_call("sudo chown -R $USER:$USER php-yii2", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:

+ 9 - 0
frameworks/PHP/php-zend-framework/bash_profile.sh

@@ -0,0 +1,9 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export COMPOSER_HOME=${IROOT}/php-composer
+
+export PATH="$COMPOSER_HOME:$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 1 - 1
frameworks/PHP/php-zend-framework/install.sh

@@ -1,3 +1,3 @@
 #!/bin/bash
 
-fw_depends php nginx
+fw_depends php composer nginx

+ 4 - 7
frameworks/PHP/php-zend-framework/setup.py

@@ -1,26 +1,23 @@
 import subprocess
 import sys
 import setup_util
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php-zend-framework/config/autoload/benchmarks.local.php", "host=localhost", "host=" + args.database_host)
-  setup_util.replace_text("php-zend-framework/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-zend-framework/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-zend-framework", "root " + args.troot)
 
   try:
     subprocess.check_call("composer.phar install --optimize-autoloader", shell=True, cwd="php-zend-framework", stderr=errfile, stdout=logfile)
     subprocess.check_call("sudo chown -R www-data:www-data php-zend-framework", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-zend-framework/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-zend-framework/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1
 def stop(logfile, errfile):
   try:
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat php-zend-framework/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
     subprocess.check_call("sudo chown -R $USER:$USER php-zend-framework", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:

+ 7 - 0
frameworks/PHP/php/bash_profile.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export PATH="$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 7 - 9
frameworks/PHP/php/setup.py

@@ -3,18 +3,16 @@ import subprocess
 import sys
 import setup_util
 import os
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("php/dborm.php", "@.*\/hello_world", "@" + args.database_host + "/hello_world")
   setup_util.replace_text("php/dbraw.php", "host=.*;", "host=" + args.database_host + ";")
   setup_util.replace_text("php/updateraw.php", "host=.*;", "host=" + args.database_host + ";")
   setup_util.replace_text("php/fortune.php", "host=.*;dbname", "host=" + args.database_host + ";dbname")
-  setup_util.replace_text("php/deploy/php", "\".*\/FrameworkBenchmarks", "\"" + home + "/FrameworkBenchmarks")
-  setup_util.replace_text("php/deploy/php", "Directory .*\/FrameworkBenchmarks", "Directory " + home + "/FrameworkBenchmarks")
-  setup_util.replace_text("php/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  
+  setup_util.replace_text("php/deploy/php", "\".*\/FrameworkBenchmarks/php", "\"" + args.troot)
+  setup_util.replace_text("php/deploy/php", "Directory .*\/FrameworkBenchmarks/php", "Directory " + args.troot)
+  setup_util.replace_text("php/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php", "root " + args.troot)
   
   try:
     if os.name == 'nt':
@@ -25,8 +23,8 @@ def start(args, logfile, errfile):
     #subprocess.check_call("sudo a2ensite php", shell=True)
     #subprocess.check_call("sudo chown -R www-data:www-data php", shell=True)
     #subprocess.check_call("sudo /etc/init.d/apache2 start", shell=True)
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     
     return 0
   except subprocess.CalledProcessError:
@@ -38,7 +36,7 @@ def stop(logfile, errfile):
       return 0
     
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat php/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
     
     return 0
   except subprocess.CalledProcessError:

+ 7 - 0
frameworks/PHP/phreeze/bash_profile.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.4.13
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export PATH="$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"

+ 6 - 9
frameworks/PHP/phreeze/setup.py

@@ -2,15 +2,12 @@ import subprocess
 import sys
 import setup_util
 import os
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("phreeze/index.php", "localhost:3306", "" + args.database_host + ":3306")
-  setup_util.replace_text("phreeze/deploy/phreeze", "\".*\/FrameworkBenchmarks", "\"" + home + "/FrameworkBenchmarks")
-  setup_util.replace_text("phreeze/deploy/phreeze", "Directory .*\/FrameworkBenchmarks", "Directory " + home + "/FrameworkBenchmarks")
-  setup_util.replace_text("phreeze/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("phreeze/deploy/phreeze", "\".*\/FrameworkBenchmarks/phreeze", "\"" + args.troot)
+  setup_util.replace_text("phreeze/deploy/phreeze", "Directory .*\/FrameworkBenchmarks/phreeze", "Directory " + args.troot)
+  setup_util.replace_text("phreeze/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/phreeze", "root " + args.troot)
   
   try:
     if os.name == 'nt':
@@ -21,8 +18,8 @@ def start(args, logfile, errfile):
     #subprocess.check_call("sudo a2ensite php", shell=True)
     #subprocess.check_call("sudo chown -R www-data:www-data php", shell=True)
     #subprocess.check_call("sudo /etc/init.d/apache2 start", shell=True)
-    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/phreeze/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/phreeze/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     
     return 0
   except subprocess.CalledProcessError:
@@ -33,7 +30,7 @@ def stop(logfile, errfile):
       subprocess.call('appcmd delete site PHP', shell=True, stderr=errfile, stdout=logfile)
       return 0
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat phreeze/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
     
     return 0
   except subprocess.CalledProcessError:

+ 11 - 14
frameworks/Perl/kelp/README.md

@@ -2,41 +2,38 @@
 
 * Perl 5.10+
 * MySQL 5.5
+* MongoDB
 * Wrk 2.0
 
 # Requirements
 
 * Kelp (install from CPAN)
 * Kelp::Module::JSON::XS (install from CPAN)
+* Kelp::Module::Template::Toolkit (install from CPAN)
 * DBD::mysql (install from CPAN)
 * Starman (install from CPAN)
+* MongoDB (install from CPAN)
 * nginx (if you want to front with nginx, nginx.conf provided)
 
 # Deployment
 
-## uWSGI (Recommended)
+## uWSGI (recommended)
 
-1. Create a configuration file. Bare bones example of app.ini:
+1. Make sure you have installed the psgi plugin.
+2. Deploy:
 
-    [uwsgi]
-    http-socket = :8080
-    psgi = app.pl
-
-2. Make sure you have installed the psgi plugin.
-
-3. Deploy with uwsgi
-
-    uwsgi --http-modifier1 5 --plugin psgi --ini app.ini
+    ./uwsgi --plugins psgi --init app.ini
 
 ## Plack + Starman
 
 1. Deploy via plackup
 
-    plackup -E production -s Starman --workers=5 -l /tmp/frameworks-benchmark.sock -a ./app.pl
+    plackup -E deployment -s Starman --workers=25 -l /tmp/frameworks-benchmark.sock -a ./app.pl
 
 2. If you want to front it with nginx, otherwise
 
-    plackup -E production -s Starman --port=8080 --workers=5 -a ./app.pl
-    
+    plackup -E deployment -s Starman --port=8080 --workers=25 -a ./app.pl
+
 # Expert contact
+
 @naturalist ([email protected])

+ 4 - 0
frameworks/Perl/kelp/app.ini

@@ -0,0 +1,4 @@
+[uwsgi]
+http-socket = :8080
+psgi = app.pl
+disable-logging = True

+ 89 - 41
frameworks/Perl/kelp/app.pl

@@ -1,77 +1,105 @@
 #!/usr/bin/env perl
+
 use Kelp::Less;
+use HTML::Escape 'escape_html';
+use MongoDB;
 use DBI;
+use utf8;
 
-my $dsn  = "dbi:mysql:database=hello_world;host=localhost;port=3306";
-my $dbh  = DBI->connect( $dsn, 'benchmarkdbuser', 'benchmarkdbpass', {} );
-my $sth  = $dbh->prepare("SELECT * FROM World WHERE id = ?");
-my $sth1 = $dbh->prepare("SELECT * FROM Fortune");
-my $sth2 = $dbh->prepare("UPDATE World SET randomNumber = ? WHERE id = ?");
-
-get '/populate' => sub {
-    $dbh->do("DELETE FROM World");
-    $dbh->do("DELETE FROM Fortune");
-    srand;
+module 'JSON::XS';
 
-    # Add some random numbers
-    my @rand = map {'(' . $_ . ',' . int(rand(10_000)) . ')'} (1 .. 10_000);
-    $dbh->do(q[INSERT INTO World (id, randomNumber) VALUES ] . join(',', @rand));
+my $mongo   = MongoDB::MongoClient->new( host => 'localhost', port => 27017 );
+my $mdb     = $mongo->get_database('hello_world');
+my $world   = $mdb->get_collection('World');
+my $fortune = $mdb->get_collection('Fortune');
 
-    # Add some fortunes
-    my @fortunes = map { '("' . 'x' x (int(rand(20)) + 1) . '")' } (1 .. 30);
-    $dbh->do(q[INSERT INTO Fortune (message) VALUES ] . join(',', @fortunes));
+my $dbh = DBI->connect(
+    "dbi:mysql:database=hello_world;host=localhost;port=3306",
+    'benchmarkdbuser',
+    'benchmarkdbpass',
+    { RaiseError => 0, PrintError => 0, mysql_enable_utf8 => 1 }
+);
 
-    "OK";
-};
+my @sth = map { $dbh->prepare($_) } (
+    "SELECT * FROM World WHERE id = ?",
+    "SELECT * FROM Fortune",
+    "UPDATE World SET randomNumber = ? WHERE id = ?",
+);
 
 get '/json' => sub {
-    my $self = shift;
     { message => 'Hello, World!' };
 };
 
-get '/db' => sub {
-    query(1);
+get '/db/?db' => sub {
+    my ( $self, $db ) = @_;
+    query( $db // 'mongo', 1 );
 };
 
-get '/queries' => sub {
-    my $self = shift;
-    my $count = $self->param('queries') || 1;
-    query( $count > 500 ? 500 : $count );
+get '/queries/?db' => sub {
+    my ( $self, $db ) = @_;
+    query( $db // 'mongo', $self->param('queries') );
 };
 
-get '/fortunes' => sub {
-    my $self = shift;
-    $sth1->execute();
-    my $fortunes = $sth1->fetchall_arrayref({});
-    $self->template( 'fortunes', { fortunes => $fortunes } );
+get '/fortunes/?db' => sub {
+    my ( $self, $db ) = @_;
+    $db //= 'mongo';
+    my @objects;
+    if ( $db eq 'mongo' ) {
+        my $cursor = $fortune->query( {} );
+        @objects = $cursor->all;
+    }
+    else {
+        $sth[1]->execute();
+        @objects = @{ $sth[1]->fetchall_arrayref( {} ) };
+    }
+    push @objects, { id => 0, message => "Additional fortune added at request time." };
+    fortunes( \@objects );
 };
 
-get '/updates' => sub {
-    my $self  = shift;
-    my $count = $self->param('queries');
-    my $arr   = query( $count > 500 ? 500 : $count );
+get '/update/?db' => sub {
+    my ( $self, $db ) = @_;
+    $db //= 'mongo';
+
+    my $arr = query( $db, $self->param('queries') );
+    $arr = [$arr] unless ref($arr) eq 'ARRAY';
     for my $row (@$arr) {
         $row->{randomNumber} = int( rand(10_000) ) + 1;
-        $sth2->execute( $row->{randomNumber}, $row->{id} );
+        if ( $db eq 'mongo' ) {
+            $world->update( { _id => $row->{id} },
+                { randomNumber => $row->{randomNumber} } );
+        }
+        else {
+            $row->{randomNumber} = int( rand(10_000) ) + 1;
+            $sth[2]->execute( $row->{randomNumber}, $row->{id} );
+        }
     }
 
-    $arr;
+    return $arr;
 };
 
 get '/plaintext' => sub {
-    my $self = shift;
-    $self->res->text->render('Hello, World!');
+    shift->res->text->render('Hello, World!');
 };
 
 run;
 
 sub query {
-    my $count = shift;
+    my ( $db, $count ) = @_;
+    $count //= 1;
+    $count = 1 if ( $count !~ /^\d+$/ || $count < 1 );
+    $count = 500 if $count > 500;
     my @response;
     for ( 1 .. $count ) {
         my $id = int rand 10000 + 1;
-        $sth->execute($id);
-        if ( my $row = $sth->fetchrow_hashref ) {
+        my $row;
+        if ( $db eq 'mongo' ) {
+            $row = $world->find_one( { _id => $id } );
+        }
+        else {
+            $sth[0]->execute($id);
+            $row = $sth[0]->fetchrow_hashref;
+        }
+        if ($row) {
             if ( $count == 1 ) {
                 return { id => $id, randomNumber => $row->{randomNumber} };
             }
@@ -83,3 +111,23 @@ sub query {
     }
     return \@response;
 }
+
+sub fortunes {
+    my ($objects) = @_;
+    my $res = q[<!DOCTYPE html><html><head><title>Fortunes</title></head>];
+    $res .= q[<body><table><tr><th>id</th><th>message</th></tr>];
+
+    for my $item ( sort { $a->{message} cmp $b->{message} } @$objects ) {
+        my $id = $item->{id};
+        my $message = escape_html( $item->{message} );
+
+        # HTML::Escape encodes apostrophe as &#39; because IE8 does not
+        # support &apos;. We forse an &apos; here in order to pass the
+        # test
+        $message =~ s/&#39/&apos/g;
+        $res .= "<tr><td>$id</td><td>$message</td></tr>";
+    }
+
+    $res .= q[</table></body></html>];
+    return $res;
+}

+ 26 - 3
frameworks/Perl/kelp/benchmark_config

@@ -6,16 +6,39 @@
       "json_url": "/json",
       "db_url": "/db",
       "query_url": "/queries?queries=",
-      "fortune_url": "/fortune",
+      "fortune_url": "/fortunes",
       "update_url": "/update?queries=",
       "plaintext_url": "/plaintext",
       "port": 8080,
       "approach": "Realistic",
       "classification": "Fullstack",
-      "database": "MySQL",
+      "database": "SQL",
       "framework": "kelp",
       "language": "Perl",
-      "orm": "Full",
+      "orm": "Raw",
+      "platform": "Plack",
+      "webserver": "Starman",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "kelp",
+      "notes": "",
+      "versus": ""
+    },
+    "mongodb": {
+      "setup_file": "setup",
+      "json_url": "/json",
+      "db_url": "/db",
+      "query_url": "/queries/mongo?queries=",
+      "fortune_url": "/fortunes/mongo",
+      "update_url": "/update/mongo?queries=",
+      "plaintext_url": "/plaintext",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Fullstack",
+      "database": "MongoDB",
+      "framework": "kelp",
+      "language": "Perl",
+      "orm": "Raw",
       "platform": "Plack",
       "webserver": "Starman",
       "os": "Linux",

+ 0 - 3
frameworks/Perl/kelp/conf/config.pl

@@ -1,3 +0,0 @@
-{
-    modules    => ['JSON::XS', 'Template'],
-}

+ 9 - 1
frameworks/Perl/kelp/install.sh

@@ -2,5 +2,13 @@
 
 fw_depends perl nginx
 
-cpanm --notest --no-man-page Kelp DBI DBD::mysql Kelp::Module::JSON::XS Plack Starman
+cpanm --notest --no-man-page \
+    Kelp \
+    DBI \
+    DBD::mysql \
+    MongoDB \
+    Kelp::Module::JSON::XS \
+    HTML::Escape \
+    HTTP::Parser::XS \
+    Starman
 echo installed Kelp app dependencies

+ 2 - 2
frameworks/Perl/kelp/setup.py

@@ -8,10 +8,10 @@ import getpass
 def start(args, logfile, errfile):
   setup_util.replace_text("kelp/app.pl", "localhost", args.database_host)
   setup_util.replace_text("kelp/nginx.conf", "USR", getpass.getuser())
-  setup_util.replace_text("kelp/nginx.conf", "server unix:.*\/FrameworkBenchmarks", "server unix:" + args.fwroot)
+  setup_util.replace_text("kelp/nginx.conf", "server unix:.*\/FrameworkBenchmarks/kelp", "server unix:" + args.troot)
 
   try:
-    subprocess.Popen("plackup -E production -s Starman --workers=" + str(args.max_threads) + " -l $TROOT/frameworks-benchmark.sock -a $TROOT/app.pl", shell=True, cwd="kelp", stderr=errfile, stdout=logfile)
+    subprocess.Popen("plackup -E deployment -s Starman --workers=" + str(args.max_threads) + " -l $TROOT/frameworks-benchmark.sock -a $TROOT/app.pl", shell=True, cwd="kelp", stderr=errfile, stdout=logfile)
     subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:

+ 56 - 0
frameworks/Perl/kelp/t/main.t

@@ -0,0 +1,56 @@
+use strict;
+use warnings;
+use utf8;
+
+use Kelp::Test;
+use Test::More;
+use Test::Deep;
+use HTTP::Request::Common;
+
+my $t = Kelp::Test->new( psgi => 'app.pl');
+my $world = { randomNumber => re(qr{^\d+$}), id => re(qr{^\d+$}) };
+
+subtest 'json' => sub {
+    $t->request( GET '/json' )->json_cmp( { message => 'Hello, World!' } );
+};
+
+subtest plaintext => sub {
+    $t->request( GET '/plaintext' )
+      ->content_type_is('text/plain')
+      ->content_is('Hello, World!');
+};
+
+subtest db => sub {
+    for my $uri (qw{/db /db/mongo}) {
+        $t->request( GET $uri )->json_cmp($world);
+    }
+};
+
+subtest queries => sub {
+    for my $uri (qw{/queries /queries/mongo}) {
+        $t->request( GET $uri )->json_cmp($world);
+        $t->request( GET "$uri?queries=3" )
+          ->json_cmp( [ $world, $world, $world ] );
+        $t->request( GET "$uri?queries=0" )->json_cmp($world);
+    }
+};
+
+subtest update => sub {
+    for my $uri (qw{/update /update/mongo}) {
+        $t->request( GET $uri )->json_cmp([$world]);
+        $t->request( GET "$uri?queries=3" )
+          ->json_cmp( [ $world, $world, $world ] );
+    }
+};
+
+subtest fortunes => sub {
+    for my $uri (qw{/fortunes /fortunes/mongo}) {
+        $t->request( GET $uri )
+          ->content_type_is('text/html')
+          ->content_like(qr{&lt;script&gt;})
+          ->content_like(qr{フレームワークのベンチマーク})
+          ->content_like(qr{Additional fortune added at request time.});
+    }
+};
+
+done_testing;

+ 0 - 10
frameworks/Perl/kelp/views/fortunes.tt

@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head><title>Fortunes</title></head>
-<body>
-<table>
-<tr><th>id</th><th>message</th></tr>
-[% FOREACH item IN fortunes  %]<tr><td>[% item.id %]</td><td>[% item.message %]</td></tr>[% END %]
-</table>
-</body>
-</html>

+ 0 - 33
frameworks/Scala/play-scala/.gitignore

@@ -1,33 +0,0 @@
-logs
-project/project
-project/target
-public
-target
-test
-tmp
-.history
-dist
-conf/evolutions
-
-# Ignore all dotfiles...
-.*
-# except for .gitignore
-!.gitignore
-
-# Ignore Play! working directory #
-db
-eclipse
-lib
-log
-logs
-modules
-precompiled
-project/project
-project/target
-target
-tmp
-test-result
-server.pid
-*.iml
-*.eml
-

+ 0 - 27
frameworks/Scala/play-scala/README.md

@@ -1,27 +0,0 @@
-#Play Benchmarking Test
-
-This is the Play portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
-
-### JSON Encoding Test
-
-* [JSON test source](app/controllers/Application.scala)
-
-### Data-Store/Database Mapping Test
-
-* [Database test controller](app/controllers/Application.scala)
-* [Database test model](app/models/World.scala)
-
-## Infrastructure Software Versions
-The tests were run with:
-
-* [Java OpenJDK 1.7.0_09](http://openjdk.java.net/)
-* [Play 2.1.0](http://http://www.playframework.com/)
-
-## Test URLs
-### JSON Encoding Test
-
-http://localhost/json
-
-### Data-Store/Database Mapping Test
-
-http://localhost/db?queries=5

+ 0 - 0
frameworks/Scala/play-scala/__init__.py


+ 0 - 93
frameworks/Scala/play-scala/app/controllers/Application.scala

@@ -1,93 +0,0 @@
-package controllers
-
-import play.api.Play.current
-import play.api.mvc._
-import play.api.libs.json.Json
-import java.util.concurrent._
-import scala.concurrent._
-import models.{World, Fortune}
-import utils._
-import scala.concurrent.Future
-
-import play.api.libs.concurrent.Execution.Implicits._
-import play.core.NamedThreadFactory
-
-object Application extends Controller {
-
-  private val MaxQueriesPerRequest = 20
-  private val TestDatabaseRows = 10000
-
-  private val partitionCount = current.configuration.getInt("db.default.partitionCount").getOrElse(2)
-  private val maxConnections =
-    partitionCount * current.configuration.getInt("db.default.maxConnectionsPerPartition").getOrElse(5)
-  private val minConnections =
-    partitionCount * current.configuration.getInt("db.default.minConnectionsPerPartition").getOrElse(5)
-
-  private val tpe = new ThreadPoolExecutor(minConnections, maxConnections,
-    0L, TimeUnit.MILLISECONDS,
-    new LinkedBlockingQueue[Runnable](),
-    new NamedThreadFactory("dbEc"))
-  private val dbEc = ExecutionContext.fromExecutorService(tpe)
-
-  // A predicate for checking our ability to service database requests is determined by ensuring that the request
-  // queue doesn't fill up beyond a certain threshold. For convenience we use the max number of connections * the max
-  // # of db requests per web request to determine this threshold. It is a rough check as we don't know how many
-  // queries we're going to make or what other threads are running in parallel etc. Nevertheless, the check is
-  // adequate in order to throttle the acceptance of requests to the size of the pool.
-  def isDbAvailable: Boolean = tpe.getQueue.size() < maxConnections * MaxQueriesPerRequest
-
-
-  def json() = Action {
-    Ok(Json.obj("message" -> "Hello, World!"))
-  }
-
-  def db(queries: Int) = PredicatedAction(isDbAvailable, ServiceUnavailable) {
-    Action.async {
-      val random = ThreadLocalRandom.current()
-
-      val worlds = Future.sequence((for {
-        _ <- 1 to queries
-      } yield Future(World.findById(random.nextInt(TestDatabaseRows) + 1))(dbEc)
-        ).toList)
-
-      worlds map {
-        w => Ok(Json.toJson(w))
-      }
-    }
-  }
-
-  def fortunes() = PredicatedAction(isDbAvailable, ServiceUnavailable) {
-    Action.async {
-      Future(Fortune.getAll())(dbEc).map { fs =>
-        val fortunes =  Fortune(0.toLong, "Additional fortune added at request time.") +: fs
-        Ok(views.html.fortune(fortunes))
-      }
-    }
-  }
-
-  def update(queries: Int) = PredicatedAction(isDbAvailable, ServiceUnavailable) {
-    Action.async {
-      val random = ThreadLocalRandom.current()
-
-      val boundsCheckedQueries = queries match {
-        case q if q > 500 => 500
-        case q if q <   1 => 1
-        case _ => queries
-      }
-
-      val worlds = Future.sequence((for {
-        _ <- 1 to boundsCheckedQueries
-      } yield Future {
-          val world = World.findById(random.nextInt(TestDatabaseRows) + 1)
-          val updatedWorld = world.copy(randomNumber = random.nextInt(TestDatabaseRows) + 1)
-          World.updateRandom(updatedWorld)
-          updatedWorld
-        }(dbEc)
-      ).toList)
-
-      worlds.map {
-        w => Ok(Json.toJson(w)).withHeaders("Server" -> "Netty")
-      }
-    }
-  }
-}

+ 0 - 25
frameworks/Scala/play-scala/app/models/Fortune.scala

@@ -1,25 +0,0 @@
-package models
-
-import play.api.db._
-import play.api.Play.current
-import anorm._
-import anorm.SqlParser._
-import scala.language.postfixOps
-
-case class Fortune(id: Long, message: String)
-
-object Fortune {
-
-  val simpleRowParser = {
-    get[Long]("fortune.id") ~
-    get[String]("fortune.message") map {
-      case id~message => Fortune(id, message)
-    }
-  }
-
-  def getAll(): List[Fortune] = {
-    DB.withConnection { implicit connection =>
-      SQL("SELECT * FROM Fortune").as(Fortune.simpleRowParser *)
-    }
-  }
-}

+ 0 - 54
frameworks/Scala/play-scala/app/models/World.scala

@@ -1,54 +0,0 @@
-package models
-
-import play.api.db._
-import play.api.Play.current
-import anorm._
-import anorm.SqlParser._
-import play.api.libs.json._
-import play.api.libs.functional.syntax._
-
-case class World(id: Pk[Long], randomNumber: Long)
-
-object World {
-    /**
-    * Convert a World to Json object
-    */
-  implicit val toJson = new Writes[World] {
-    def writes(w: World): JsValue = {
-      Json.obj(
-        "id" -> w.id.get,
-        "randomNumber" -> w.randomNumber
-      )
-    }
-  }
-
-  /**
-   * Parse a World from a ResultSet
-   */
-  val simpleRowParser = {
-    get[Pk[Long]]("world.id") ~
-    get[Long]("world.randomNumber") map {
-      case id~randomNumber => World(id, randomNumber)
-    }
-  }
-
-  /**
-   * Retrieve a World by id.
-   */
-  def findById(id: Long): World = {
-    DB.withConnection { implicit connection =>
-      SQL("SELECT * FROM World WHERE id = {id}").on(
-          "id" -> id
-      ).as(World.simpleRowParser.single)
-    }
-  }
-
-  def updateRandom(world: World) {
-    DB.withConnection { implicit connection =>
-      SQL("UPDATE World SET randomNumber = {randomNumber} WHERE id = {id}").on(
-        "id" -> world.id.get,
-        "randomNumber" -> world.randomNumber
-      ).executeUpdate()
-    }
-  }
-}

+ 0 - 20
frameworks/Scala/play-scala/app/utils/PredicatedAction.scala

@@ -1,20 +0,0 @@
-package utils
-
-import play.api.mvc._
-import scala.concurrent.{Promise, Future}
-
-/**
- * A predicated action is one where a condition must be satisfied in order to proceed with the request. If the
- * condition is not satisfied then a supplied status result is yielded.
- */
-class PredicatedActionBuilder {
-  def apply[A](p: => Boolean, failed: => SimpleResult)(action: Action[A]): Action[A] = new Action[A] {
-    def apply(request: Request[A]): Future[SimpleResult] = {
-      if (p) action(request) else Promise.successful(failed).future
-    }
-
-    lazy val parser = action.parser
-  }
-}
-
-object PredicatedAction extends PredicatedActionBuilder

Some files were not shown because too many files changed in this diff