by Philipp Bergsmann

This post describes a proof of concept for serving TYPO3 with NGINX/HHVM and a PHP-FPM fallback for incompatible scripts. Since I am using debian this post targets debian wheezy. in this post you’ll find some performance comparisons.

Installing the required packages

We will need:

  • Nginx
  • HHVM
  • PHP

TYPO3 specific packages:

  • MySQL/MariaDB
  • Graphicsmagick
  • PHP modules: curl, gd, mysqlnd
wget -O - | sudo apt-key add -
echo deb wheezy main | sudo tee /etc/apt/sources.list.d/hhvm.list
sudo apt-get update
sudo apt-get install nginx hhvm graphicsmagick mysql-server php5 php5-curl php5-fpm php5-gd php5-mysqlnd

Now make sure that php-fpm, hhvm and nginx service are all running!

Configuring NGINX

Create a new site configuration e.g. /etc/nginx/sites-available/demo with the following content, symlink it to /etc/nginx/sites-enabled/demo and reload nginx:

Special configuration explanation

Line 69 enables error interception for fast-cgi. With this setting it’s possible to redirect the request to the PHP-FPM on error 500 (see line 70). You can extend line 70 with every error-code you want to redirect to PHP-FPM.


error_page      500 501 502 503 = @fpm;

Testing the configuration

First test if the default PHP-runtime is HHVM by providing the following index.php:



This should return “HipHop”.

Now let’s try the PHP-FPM fallback by providing the following fallback.php:


if (defined('HHVM_VERSION')) {
        throw new Exception();


This should return the usual PHP-info.

If I forgot something or something is wrong let me know through the comments!

About the author
Philipp Bergsmann

I'm Philipp Bergsmann, I co-founded opendo in 2010. I work as a TYPO3 developer and IT operations engineer.

blog comments powered by Disqus