Browse Source

Merge pull request #1854 from TechEmpower/php7-addition

Added php7 to toolset and updated nginx
Mike Smith 9 years ago
parent
commit
a4b27f178f

+ 2 - 2
config/php.ini

@@ -869,8 +869,8 @@ default_socket_timeout = 60
 zend_extension=opcache.so
 extension=redis.so
 extension=phalcon.so
-extension=yaf.so
-extension=mongo.so
+;extension=yaf.so
+extension=mongodb.so
 ;extension=php_bz2.dll
 ;extension=php_curl.dll
 ;extension=php_fileinfo.dll

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

@@ -1,6 +1,6 @@
 #!/bin/bash
 
-fw_depends nginx php hhvm
+fw_depends nginx php7 hhvm
 
 sed -i 's|host=localhost;|host='"${DBHOST}"';|g' once.php.inc
 sed -i 's|SourceRoot = .*/FrameworkBenchmarks/hhvm|SourceRoot = '"${TROOT}"'|g' deploy/config.hdf

+ 2 - 0
frameworks/PHP/laravel/.gitignore

@@ -1,3 +1,5 @@
+deploy/nginx.conf
+deploy/php-fpm.pid
 /bootstrap/compiled.php
 /vendor
 composer.phar

+ 15 - 3
frameworks/PHP/laravel/app/routes.php

@@ -21,16 +21,28 @@ Route::get('/plaintext', function()
     return "Hello, World!";
 });
 
-Route::get('/db', function()
+Route::get('/query', function()
 {
     $queries = Input::get('queries', 1);
+
+    if (!is_numeric($queries) || $queries <= 1) {
+    	$queries = 1;
+    }
+    else if ($queries > 500) {
+        $queries = 500;
+    }
+
     $worlds = array();
 
-    for($i = 0; $i < $queries; ++$i) {
+    for($i = 0; $i < $queries; $i++) {
         $worlds[] = DB::table('World')->find(mt_rand(1, 10000));
     }
-
     return Response::json($worlds);
 });
 
+Route::get('/db', function()
+{
+    return Response::json(DB::table('World')->find(mt_rand(1, 10000)));
+});
+
 Route::get('/fortunes', 'BenchController@fortunes');

+ 43 - 4
frameworks/PHP/laravel/benchmark_config.json

@@ -23,7 +23,7 @@
     "raw": {
       "setup_file": "setup",
       "db_url": "/db",
-      "query_url": "/db?queries=",
+      "query_url": "/query?queries=",
       "fortune_url": "/fortunes",
       "port": 8080,
       "approach": "Realistic",
@@ -36,7 +36,7 @@
       "webserver": "nginx",
       "os": "Linux",
       "database_os": "Linux",
-      "display_name": "laravel",
+      "display_name": "laravel-raw",
       "notes": "",
       "versus": "php"
     },
@@ -62,7 +62,7 @@
     "hhvm-raw": {
       "setup_file": "setup_hhvm",
       "db_url": "/db",
-      "query_url": "/db?queries=",
+      "query_url": "/query?queries=",
       "fortune_url": "/fortunes",
       "port": 8080,
       "approach": "Realistic",
@@ -78,6 +78,45 @@
       "display_name": "laravel_hhvm",
       "notes": "",
       "versus": "php"
+    },
+    "php5": {
+      "setup_file": "setup_php5",
+      "json_url": "/json",
+      "plaintext_url": "/plaintext",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Fullstack",
+      "database": "None",
+      "framework": "laravel",
+      "language": "PHP",
+      "orm": "Raw",
+      "platform": "PHP-FPM",
+      "webserver": "nginx",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "laravel",
+      "notes": "",
+      "versus": "php"
+    },
+    "php5-raw": {
+      "setup_file": "setup_php5",
+      "db_url": "/db",
+      "query_url": "/query?queries=",
+      "fortune_url": "/fortunes",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Fullstack",
+      "database": "MySQL",
+      "framework": "laravel",
+      "language": "PHP5",
+      "orm": "Raw",
+      "platform": "PHP-FPM",
+      "webserver": "nginx",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "laravel-php5-raw",
+      "notes": "",
+      "versus": "php"
     }
   }]
-}
+}

+ 3 - 3
frameworks/PHP/laravel/readme.md

@@ -23,8 +23,8 @@ Uses Laravels template engine 'blade'
 The tests were run with:
 
 * [Laravel Version 4.2](http://laravel.com/)
-* [PHP Version 5.5.17](http://www.php.net/) with FPM and APC
-* [nginx 1.4.1](http://nginx.org/)
+* [PHP Version 7.0.1](http://www.php.net/) with FPM and APC
+* [nginx 1.9.9](http://nginx.org/)
 * [MySQL 5.5.29](https://dev.mysql.com/)
 
 ## Test URLs
@@ -42,4 +42,4 @@ http://localhost/db?queries=2
 
 ### Templating Test
 
-http://localhost/fortunes
+http://localhost/fortunes

+ 1 - 1
frameworks/PHP/laravel/setup.sh

@@ -1,6 +1,6 @@
 #!/bin/bash
 
-fw_depends php nginx composer
+fw_depends php7 nginx composer
 
 sed -i 's|127.0.0.1|'"${DBHOST}"'|g' app/config/database.php
 sed -i 's|root .*/FrameworkBenchmarks/frameworks/PHP/php-laravel|root '"${TROOT}"'|g' deploy/nginx.conf 

+ 1 - 1
frameworks/PHP/laravel/setup_hhvm.sh

@@ -1,6 +1,6 @@
 #!/bin/bash
 
-fw_depends php nginx composer hhvm
+fw_depends php7 nginx composer hhvm
 
 sed -i 's|127.0.0.1|'"${DBHOST}"'|g' app/config/database.php
 sed -i 's|SourceRoot = .*/FrameworkBenchmarks/php-laravel|SourceRoot = '"${TROOT}"'|g' deploy/config.hdf

+ 10 - 0
frameworks/PHP/laravel/setup_php5.sh

@@ -0,0 +1,10 @@
+#!/bin/bash
+
+fw_depends php nginx composer
+
+sed -i 's|127.0.0.1|'"${DBHOST}"'|g' app/config/database.php
+sed -i 's|root .*/FrameworkBenchmarks/frameworks/PHP/php-laravel|root '"${TROOT}"'|g' deploy/nginx.conf 
+sed -i 's|/home/vagrant/FrameworkBenchmarks/installs/nginx/|'"${IROOT}"'/nginx/|g' deploy/nginx.conf
+
+php-fpm --fpm-config ${FWROOT}/config/php-fpm.conf -g ${TROOT}/deploy/php-fpm.pid
+nginx -c ${TROOT}/deploy/nginx.conf

+ 8 - 1
frameworks/PHP/php/.gitignore

@@ -1,2 +1,9 @@
-deploy/php-fpm.pid
+# These files are touched during framework tests, but may need to be edited at times. Make sure to force add the files you edit.
+
+dborm.php
+dbraw.php
+fortune.php
+updateraw.php
+deploy/
 vendor/
+

+ 5 - 2
frameworks/PHP/php/README.md

@@ -2,6 +2,9 @@
 
 This is the PHP portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
 
+### Important
+When editing this framework, be sure to force add the files changed. Most files were added to .gitignore, as the framework touches some of them during testing.
+
 ### JSON Encoding Test
 Use the PHP standard [JSON encoder](http://www.php.net/manual/en/function.json-encode.php)
 
@@ -15,8 +18,8 @@ Use the PHP standard [JSON encoder](http://www.php.net/manual/en/function.json-e
 ## Infrastructure Software Versions
 The tests were run with:
 
-* [PHP Version 5.5.17](http://www.php.net/) with FPM and APC
-* [nginx 1.4.0](http://nginx.org/)
+* [PHP Version 7.0.1](http://www.php.net/) with FPM and APC
+* [nginx 1.9.9](http://nginx.org/)
 * [MySQL 5.5.29](https://dev.mysql.com/)
 * [PHP ActiveRecord Nightly 20121221](http://www.phpactiverecord.org/)
 

+ 42 - 0
frameworks/PHP/php/benchmark_config.json

@@ -42,6 +42,48 @@
       "display_name": "php",
       "notes": "",
       "versus": "php"
+    },
+    "php5": {
+      "setup_file": "setup_php5",
+      "json_url": "/json.php",
+      "plaintext_url": "/plaintext.php",
+      "db_url": "/dborm.php",
+      "query_url": "/dborm.php?queries=",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Platform",
+      "database": "MySQL",
+      "framework": "php",
+      "language": "PHP5",
+      "orm": "Full",
+      "platform": "PHP-FPM",
+      "webserver": "nginx",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "php5",
+      "notes": "",
+      "versus": "php"
+    },
+    "php5-raw": {
+      "setup_file": "setup",
+      "db_url": "/dbraw.php",
+      "query_url": "/dbraw.php?queries=",
+      "fortune_url": "/fortune.php",
+      "update_url": "/updateraw.php?queries=",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Platform",
+      "database": "MySQL",
+      "framework": "php",
+      "language": "PHP5",
+      "orm": "Raw",
+      "platform": "PHP-FPM",
+      "webserver": "nginx",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "php5-raw",
+      "notes": "",
+      "versus": "php"
     }
   }]
 }

+ 1 - 1
frameworks/PHP/php/setup.sh

@@ -1,6 +1,6 @@
 #!/bin/bash
 
-fw_depends php nginx composer
+fw_depends php7 nginx composer
 
 sed -i "s|localhost|${DBHOST}|g" dborm.php
 sed -i "s|localhost|${DBHOST}|g" dbraw.php

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

@@ -0,0 +1,16 @@
+#!/bin/bash
+
+fw_depends php nginx composer
+
+sed -i "s|localhost|${DBHOST}|g" dborm.php
+sed -i "s|localhost|${DBHOST}|g" dbraw.php
+sed -i "s|localhost|${DBHOST}|g" updateraw.php
+sed -i "s|localhost|${DBHOST}|g" fortune.php
+
+sed -i "s|TEST_ROOT|${TROOT}|g" deploy/php
+sed -i "s|TEST_ROOT|${TROOT}|g" deploy/nginx.conf
+
+sed -i "s|/usr/local/nginx/|${IROOT}/nginx/|g" deploy/nginx.conf
+
+php-fpm --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid
+nginx -c $TROOT/deploy/nginx.conf

+ 2 - 0
frameworks/PHP/slim/.gitignore

@@ -1,3 +1,5 @@
+deploy/nginx.conf
+deploy/php-fpm.pid
 /app/cache
 /app/logs
 /bin

+ 2 - 2
frameworks/PHP/slim/README.md

@@ -19,8 +19,8 @@ The tests were run with:
 
 * [Slim 2.2.0](http://www.slimframework.com/)
 * [RedBeanPHP 3.4.2](http://redbeanphp.com/)
-* [PHP Version 5.5.17](http://www.php.net/) with FPM and APC
-* [nginx 1.4.0](http://nginx.org/)
+* [PHP Version 7.0.1](http://www.php.net/) with FPM and APC
+* [nginx 1.9.9](http://nginx.org/)
 * [MySQL 5.5.29](https://dev.mysql.com/)
 
 ## Test URLs

+ 20 - 0
frameworks/PHP/slim/benchmark_config.json

@@ -40,6 +40,26 @@
       "display_name": "slim_hhvm",
       "notes": "",
       "versus": "php"
+    },
+    "php5": {
+      "setup_file": "setup_php5",
+      "json_url": "/json",
+      "db_url": "/db",
+      "query_url": "/dbs?queries=",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Micro",
+      "database": "MySQL",
+      "framework": "slim",
+      "language": "PHP5",
+      "orm": "Raw",
+      "platform": "PHP-FPM",
+      "webserver": "nginx",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "slim-php5",
+      "notes": "",
+      "versus": "php"
     }
   }]
 }

+ 1 - 0
frameworks/PHP/slim/deploy/php-fpm.pid

@@ -0,0 +1 @@
+17666

+ 1 - 1
frameworks/PHP/slim/setup.sh

@@ -1,6 +1,6 @@
 #!/bin/bash
 
-fw_depends php nginx
+fw_depends php7 nginx
 
 sed -i 's|localhost|'"${DBHOST}"'|g' index.php
 sed -i 's|root .*/FrameworkBenchmarks/php-slim| root '"${TROOT}"'|g' deploy/nginx.conf

+ 10 - 0
frameworks/PHP/slim/setup_php5.sh

@@ -0,0 +1,10 @@
+#!/bin/bash
+
+fw_depends php nginx
+
+sed -i 's|localhost|'"${DBHOST}"'|g' index.php
+sed -i 's|root .*/FrameworkBenchmarks/php-slim| root '"${TROOT}"'|g' deploy/nginx.conf
+sed -i 's|/usr/local/nginx/|'"${IROOT}"'/nginx/|g' deploy/nginx.conf
+
+php-fpm --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid
+nginx -c $TROOT/deploy/nginx.conf

+ 3 - 3
toolset/setup/linux/languages/php.sh

@@ -47,7 +47,7 @@ $PHP_HOME/bin/pecl config-set php_ini $PHP_HOME/lib/php.ini
 printf "\n" | $PHP_HOME/bin/pecl -q install -f redis
 
 # yaf.so
-printf "\n" | $PHP_HOME/bin/pecl -q install -f yaf
+# printf "\n" | $PHP_HOME/bin/pecl -q install -f yaf
 
 # phalcon.so
 #   The configure seems broken, does not respect prefix. If you 
@@ -65,8 +65,8 @@ $PHP_HOME/bin/phpize
 make --quiet
 make install
 
-# mongo.so
-printf "\n" | $PHP_HOME/bin/pecl -q install -f mongo
+# mongodb.so
+printf "\n" | $PHP_HOME/bin/pecl -q install -f mongodb
 
 # Clean up a bit
 rm -rf $IROOT/php

+ 60 - 0
toolset/setup/linux/languages/php7.sh

@@ -0,0 +1,60 @@
+#!/bin/bash
+
+RETCODE=$(fw_exists ${IROOT}/php7.installed)
+[ ! "$RETCODE" == 0 ] || { \
+  echo "Moving PHP config files into place";
+  source $IROOT/php7.installed
+  return 0; }
+
+VERSION="7.0.1"
+PHP_HOME=$IROOT/php-$VERSION
+
+fw_get -o php-${VERSION}.tar.gz http://php.net/distributions/php-${VERSION}.tar.gz
+fw_untar php-${VERSION}.tar.gz
+mv php-${VERSION} php7
+cd php7
+
+echo "Configuring PHP quietly..."
+./configure --prefix=$PHP_HOME --with-pdo-mysql \
+  --with-mcrypt --enable-intl --enable-mbstring \
+  --enable-fpm --with-fpm-user=testrunner --with-fpm-group=testrunner \
+  --with-openssl --with-mysqli --with-zlib --enable-opcache --quiet
+echo "Making PHP quietly..."
+make --quiet
+echo "Installing PHP quietly"
+make --quiet install
+cd ..
+
+cp $FWROOT/config/php.ini $PHP_HOME/lib/php.ini
+cp $FWROOT/config/php-fpm.conf $PHP_HOME/lib/php-fpm.conf
+
+# =======================
+#
+# Install the PHP extensions that our tests need
+#    Install all of them here becuase our config file references
+#    all of these *.so
+# ========================
+echo PHP7 compilation finished, installing extensions
+
+$PHP_HOME/bin/pecl channel-update pecl.php.net
+# Apc.so
+$PHP_HOME/bin/pecl config-set php_ini $PHP_HOME/lib/php.ini
+
+#redis not available in pecl for php7 - find alternative install
+#printf "\n" | $PHP_HOME/bin/pecl -q install -f redis
+
+#removed phalcon install - separate to toolset/setup/linux/frameworks
+
+# yaf.so - get working for php7 - also separate
+#printf "\n" | $PHP_HOME/bin/pecl -q install -f yaf
+
+# mongodb.so - mongo.so deprecated in php7 use mongodb.so
+printf "\n" | $PHP_HOME/bin/pecl -q install -f mongodb
+
+# Clean up a bit
+rm -rf $IROOT/php7
+
+echo "export PHP_HOME=${PHP_HOME}" > $IROOT/php7.installed
+echo -e "export PATH=\$PHP_HOME/bin:\$PHP_HOME/sbin:\$PATH" >> $IROOT/php7.installed
+
+source $IROOT/php7.installed

+ 0 - 2
toolset/setup/linux/systools/composer.sh

@@ -1,7 +1,5 @@
 #!/bin/bash
 
-fw_depends php
-
 RETCODE=$(fw_exists ${IROOT}/composer.installed)
 [ ! "$RETCODE" == 0 ] || { \
   source $IROOT/composer.installed

+ 3 - 3
toolset/setup/linux/webservers/nginx.sh

@@ -7,9 +7,9 @@ RETCODE=$(fw_exists ${IROOT}/nginx.installed)
 
 NGINX_HOME=$IROOT/nginx
 
-fw_get -O http://nginx.org/download/nginx-1.4.1.tar.gz
-fw_untar nginx-1.4.1.tar.gz
-cd nginx-1.4.1
+fw_get -O http://nginx.org/download/nginx-1.9.9.tar.gz
+fw_untar nginx-1.9.9.tar.gz
+cd nginx-1.9.9
 
 # There is no --quiet flag that I could find...
 echo "Configuring nginx..."