Browse Source

PHP twice as fast (#3265)

* PHP  twice as fast

* Updated phalcon and fat-ree

* Updated yaf, codeigniter, slim and silex

* Updated the rest of php fws

* Updated HHVM

* The last fws
Opps!

* Nginx v1.12.2

* PHP 5.6.33 & 7.2.2
Debug disabled for better performace

* Updated PHP/README
Joan Miquel 7 years ago
parent
commit
cb38a3cd28

+ 3 - 4
frameworks/PHP/README.md

@@ -6,11 +6,10 @@ For further guidance, review the
 
 ## Infrastructre Software Versions
 
-### PHP Version
+### PHP Versions
 
-[Currently this toolset runs PHP 5.5.17](https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/toolset/setup/linux/languages/php.sh). At the moment all PHP-based frameworks use the 
-same PHP version, but we are open to receiving a pull request
-that enables supporting multiple versions. 
+[PHP 7.2.2](https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/toolset/setup/linux/languages/php/php7.sh),
+[PHP 5.6.33](https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/toolset/setup/linux/languages/php/php5.sh) and [HHVM 3.21](https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/toolset/setup/linux/languages/hhvm.sh).
 
 ## Adding New PHP-based Frameworks
 

+ 2 - 0
frameworks/PHP/cakephp/deploy/nginx.conf

@@ -35,6 +35,7 @@ http {
 
     upstream fastcgi_backend {
         server 127.0.0.1:9001;
+        keepalive 50;
     }
 
     server {
@@ -53,6 +54,7 @@ http {
         location ~ \.php$ {
             try_files $uri =404;
             fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
             fastcgi_index  index.php;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
             include        /home/vagrant/FrameworkBenchmarks/installs/nginx/conf/fastcgi_params;

+ 2 - 0
frameworks/PHP/clancats/deploy/nginx.conf

@@ -17,6 +17,7 @@ http {
 
 	upstream fastcgi_backend {
 		server 127.0.0.1:9001;
+		keepalive 50;
 	}
 
 	server {
@@ -33,6 +34,7 @@ http {
 		location ~ \.php$ {
 			try_files $uri =404;
 			fastcgi_pass   fastcgi_backend;
+			fastcgi_keep_conn on;
 			fastcgi_index  index.php;
 			fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
 			include        /usr/local/nginx/conf/fastcgi_params;

+ 2 - 0
frameworks/PHP/codeigniter/deploy/nginx.conf

@@ -35,6 +35,7 @@ http {
 
   upstream fastcgi_backend {
     server 127.0.0.1:9001;
+    keepalive 50;
   }
 
   server {
@@ -77,6 +78,7 @@ http {
     location ~ \.php$ {
       try_files $uri =404;
       fastcgi_pass   fastcgi_backend;
+      fastcgi_keep_conn on;
       fastcgi_index  index.php;
       #            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
       fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

+ 2 - 0
frameworks/PHP/cygnite/deploy/nginx.conf

@@ -35,6 +35,7 @@ http {
 
     upstream fastcgi_backend {
         server 127.0.0.1:9001;
+        keepalive 50;
     }
 
     server {
@@ -77,6 +78,7 @@ http {
         location ~ \.php$ {
             try_files $uri =404;
             fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
             fastcgi_index  index.php;
 #            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

+ 2 - 0
frameworks/PHP/fat-free/deploy/nginx.conf

@@ -35,6 +35,7 @@ http {
 
     upstream fastcgi_backend {
         server 127.0.0.1:9001;
+        keepalive 50;
     }
 
     server {
@@ -77,6 +78,7 @@ http {
         location ~ \.php$ {
             try_files $uri =404;
             fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
             fastcgi_index  index.php;
 #            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

+ 2 - 0
frameworks/PHP/fuel/deploy/nginx.conf

@@ -35,6 +35,7 @@ http {
 
     upstream fastcgi_backend {
         server 127.0.0.1:9001;
+        keepalive 50;
     }
 
     server {
@@ -77,6 +78,7 @@ http {
         location ~ \.php$ {
             try_files $uri =404;
             fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
             fastcgi_index  index.php;
 #            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

+ 2 - 2
frameworks/PHP/hhvm/deploy/nginx.conf

@@ -14,7 +14,7 @@ http {
     keepalive_timeout  65;
     upstream fastcgi_backend {
         server 127.0.0.1:9001;
-        keepalive 32;
+        keepalive 50;
     }
 
     server {
@@ -23,7 +23,7 @@ http {
         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9001
         location ~ \.(hh|php)$ {
             root TEST_ROOT;
-            #fastcgi_keep_conn on;
+            fastcgi_keep_conn on;
             fastcgi_pass   fastcgi_backend;
             #fastcgi_pass   127.0.0.1:9001;
             fastcgi_index  index.php;

+ 2 - 0
frameworks/PHP/kohana/deploy/nginx.conf

@@ -35,6 +35,7 @@ http {
 
     upstream fastcgi_backend {
         server 127.0.0.1:9001;
+        keepalive 50;
     }
 
     server {
@@ -77,6 +78,7 @@ http {
         location ~ \.php$ {
             try_files $uri =404;
             fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
             fastcgi_index  index.php;
 #            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

+ 2 - 0
frameworks/PHP/laravel/deploy/nginx.conf

@@ -35,6 +35,7 @@ http {
 
     upstream fastcgi_backend {
         server 127.0.0.1:9001;
+        keepalive 50;
     }
 
     server {
@@ -53,6 +54,7 @@ http {
         location ~ \.php$ {
             try_files $uri =404;
             fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
             fastcgi_index  index.php;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
             include        /home/vagrant/FrameworkBenchmarks/installs/nginx/conf/fastcgi_params;

+ 2 - 0
frameworks/PHP/limonade/deploy/nginx.conf

@@ -15,6 +15,7 @@ http {
 
     upstream fastcgi_backend {
         server 127.0.0.1:9001;
+        keepalive 50;
     }
 
     server {
@@ -35,6 +36,7 @@ http {
         location ~ \.php$ {
             try_files $uri =404;
             fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
             fastcgi_index  index.php;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
             include        /usr/local/nginx/conf/fastcgi_params;

+ 2 - 0
frameworks/PHP/lithium/deploy/nginx.conf

@@ -35,6 +35,7 @@ http {
 
     upstream fastcgi_backend {
         server 127.0.0.1:9001;
+        keepalive 50;
     }
 
     server {
@@ -77,6 +78,7 @@ http {
         location ~ \.php$ {
             try_files $uri =404;
             fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
             fastcgi_index  index.php;
 #            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

+ 2 - 0
frameworks/PHP/lumen/deploy/nginx.conf

@@ -15,6 +15,7 @@ http {
 
     upstream fastcgi_backend {
         server 127.0.0.1:9001;
+        keepalive 50;
     }
     server {
         listen       8080;
@@ -30,6 +31,7 @@ http {
         location ~ \.php$ {
             try_files $uri =404;
             fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
             fastcgi_index  index.php;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
             include        /usr/local/nginx/conf/fastcgi_params;

+ 2 - 0
frameworks/PHP/phalcon-micro/deploy/nginx.conf

@@ -34,6 +34,7 @@ http {
     #gzip  on;
     upstream fastcgi_backend {
         server 127.0.0.1:9001;
+        keepalive 50;
     }
     server {
         listen       8080;
@@ -75,6 +76,7 @@ http {
         location ~ \.php$ {
             try_files $uri =404;
             fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
             fastcgi_index  index.php;
 #            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

+ 2 - 0
frameworks/PHP/phalcon/deploy/nginx.conf

@@ -35,6 +35,7 @@ http {
     
     upstream fastcgi_backend {
         server 127.0.0.1:9001;
+        keepalive 50;
     }
 
     server {
@@ -77,6 +78,7 @@ http {
         location ~ \.php$ {
             try_files $uri =404;
             fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
             fastcgi_index  index.php;
 #            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

+ 3 - 0
frameworks/PHP/php/deploy/nginx.conf

@@ -35,6 +35,7 @@ http {
 
     upstream fastcgi_backend {
         server 127.0.0.1:9001;
+        keepalive 50;
     }
 
     server {
@@ -70,7 +71,9 @@ http {
         location ~ \.php$ {
             root TEST_ROOT;
             fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
 #            fastcgi_pass 127.0.0.1:9001;
+#           fastcgi_pass unix:/tmp/php-fpm.sock;
             fastcgi_index  index.php;
 #            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

+ 2 - 0
frameworks/PHP/phreeze/deploy/nginx.conf

@@ -35,6 +35,7 @@ http {
 
     upstream fastcgi_backend {
         server 127.0.0.1:9001;
+        keepalive 50;
     }
 
     server {
@@ -70,6 +71,7 @@ http {
         location ~ \.php$ {
             root /var/www/FrameworkBenchmarks/phreeze;
             fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
 #            fastcgi_pass 127.0.0.1:9001;
             fastcgi_index  index.php;
 #            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

+ 2 - 0
frameworks/PHP/silex-orm/deploy/nginx.conf

@@ -35,6 +35,7 @@ http {
 
     upstream fastcgi_backend {
         server 127.0.0.1:9001;
+        keepalive 50;
     }
 
     server {
@@ -77,6 +78,7 @@ http {
         location ~ \.php$ {
             try_files $uri =404;
             fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
             fastcgi_index  index.php;
 #            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

+ 2 - 0
frameworks/PHP/silex/deploy/nginx.conf

@@ -35,6 +35,7 @@ http {
 
     upstream fastcgi_backend {
         server 127.0.0.1:9001;
+        keepalive 50;
     }
 
     server {
@@ -77,6 +78,7 @@ http {
         location ~ \.php$ {
             try_files $uri =404;
             fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
             fastcgi_index  index.php;
 #            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

+ 2 - 0
frameworks/PHP/slim/deploy/nginx.conf

@@ -35,6 +35,7 @@ http {
 
     upstream fastcgi_backend {
         server 127.0.0.1:9001;
+        keepalive 50;
     }
 
     server {
@@ -77,6 +78,7 @@ http {
         location ~ \.php$ {
             try_files $uri =404;
             fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
             fastcgi_index  index.php;
 #            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

+ 2 - 0
frameworks/PHP/symfony/deploy/nginx.conf

@@ -35,6 +35,7 @@ http {
 
     upstream fastcgi_backend {
         server 127.0.0.1:9001;
+        keepalive 50;
     }
 
     server {
@@ -53,6 +54,7 @@ http {
         location ~ \.php$ {
             try_files $uri =404;
             fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
             fastcgi_index  index.php;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
             fastcgi_param  APP_ENV "prod";

+ 2 - 0
frameworks/PHP/yaf/deploy/nginx.conf

@@ -14,6 +14,7 @@ http {
 
     upstream fastcgi_backend {
         server 127.0.0.1:9001;
+        keepalive 50;
     }
 
     server {
@@ -35,6 +36,7 @@ http {
         location ~ \.php$ {
             try_files $uri =404;
             fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
             fastcgi_index  index.php;
             include        /usr/local/nginx/conf/fastcgi_params;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

+ 2 - 0
frameworks/PHP/yii2/deploy/nginx.conf

@@ -30,6 +30,7 @@ http {
 
     upstream fastcgi_backend {
         server 127.0.0.1:9001;
+        keepalive 50;
     }
 
     server {
@@ -48,6 +49,7 @@ http {
         location ~ \.php$ {
             fastcgi_split_path_info  ^(.+\.php)(.*)$;
             fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
             set $fsn /index.php;
             if (-f $document_root$fastcgi_script_name){
                 set $fsn $fastcgi_script_name;

+ 2 - 0
frameworks/PHP/zend/deploy/nginx.conf

@@ -35,6 +35,7 @@ http {
 
     upstream fastcgi_backend {
         server 127.0.0.1:9001;
+        keepalive 50;
     }
 
     server {
@@ -77,6 +78,7 @@ http {
         location ~ \.php$ {
             try_files $uri =404;
             fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
             fastcgi_index  index.php;
 #            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

+ 2 - 0
frameworks/PHP/zend1/deploy/nginx.conf

@@ -35,6 +35,7 @@ http {
 
     upstream fastcgi_backend {
         server 127.0.0.1:9001;
+        keepalive 50;
     }
 
     server {
@@ -77,6 +78,7 @@ http {
         location ~ \.php$ {
             try_files $uri =404;
             fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
             fastcgi_index  index.php;
 #            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

+ 1 - 0
toolset/setup/linux/languages/php/php-fpm.conf

@@ -151,6 +151,7 @@ events.mechanism = epoll
 ;   '/path/to/unix/socket' - to listen on a unix socket.
 ; Note: This value is mandatory.
 listen = 127.0.0.1:9001
+;listen = /tmp/php-fpm.sock
 
 ; Set listen(2) backlog.
 ; Default Value: 128 (-1 on FreeBSD and OpenBSD)

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

@@ -10,7 +10,7 @@ RETCODE=$(fw_exists ${IROOT}/php5.installed)
   source $IROOT/php5.installed
   return 0; }
 
-VERSION="5.6.32"
+VERSION="5.6.33"
 PHP_HOME=$IROOT/php-$VERSION
 
 # Precaution, unlikely to happen.
@@ -23,12 +23,12 @@ mv php-${VERSION} php5
 cd php5
 
 echo "Configuring PHP5 quietly..."
-./configure --prefix=$PHP_HOME --with-pdo-mysql \
+./configure --prefix=$PHP_HOME --disable-debug --with-pdo-mysql \
   --with-mysql --with-mcrypt --enable-intl --enable-mbstring \
   --enable-fpm --with-openssl --with-mysqli --with-zlib \
   --enable-opcache --quiet
 echo "Making PHP5 quietly..."
-make --quiet
+make -j2 --quiet
 echo "Installing PHP5 quietly"
 make --quiet install
 cd ..

+ 7 - 5
toolset/setup/linux/languages/php/php7.sh

@@ -20,12 +20,14 @@ mv php-${VERSION} php7
 cd php7
 
 echo "Configuring PHP quietly..."
-./configure --prefix=$PHP_HOME --with-pdo-mysql \
-  --enable-intl --enable-mbstring \
-  --enable-fpm --with-openssl --with-mysqli \
-  --with-zlib --enable-opcache --quiet
+./configure --prefix=$PHP_HOME          --disable-debug \
+            --with-zlib                 --with-pdo-mysql=mysqlnd \
+            --enable-intl               --enable-mbstring \
+            --enable-fpm                --with-openssl \
+            --with-mysqli=mysqlnd       --enable-huge-code-pages \
+            --quiet
 echo "Making PHP quietly..."
-make --quiet
+make -j2 --quiet
 echo "Installing PHP quietly"
 make --quiet install
 cd ..

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

@@ -2,7 +2,7 @@
 
 fw_installed nginx && return 0
 
-VERSION="1.12.0"
+VERSION="1.12.2"
 NGINX_HOME=$IROOT/nginx
 
 fw_get -O http://nginx.org/download/nginx-${VERSION}.tar.gz