5/3/2014 - 7:00 PM

hhvm --user vagrant -c /var/www/customer/hhvm.hdf --mode daemon

# to analyze
# find /var/www/customer/site -name '*.php' -o -name '*.phtml' > /tmp/customer_files.txt
# find /var/www/customer/site -name '*.php' > /tmp/customer_files.txt
# hhvm --hphp -t analyze --gen-stats=1 --keep-tempdir=1 --input-list /tmp/customer_files.txt --output-dir=/tmp/hphp
PidFile = /tmp/
Server {
  Port = 8080
  SourceRoot = /var/www/customer/site
#  DefaultDocument = index.php
AdminServer {
  Port = 8088
  ThreadCount = 1
  Password =
Eval {
  Jit = true
Log {
  NoSilencer = true
  Header = true
  Level = Verbose
  UseLogFile = true
  AlwaysLogUnhandledExceptions = true
  RuntimeErrorReportingLevel = 8191
  File = /var/log/hhvm/error.log
  Access {
    * {
      File = /var/log/hhvm/access.log
      Format = %h %l %u %t \"%r\" %>s %b

VirtualHost {
  * {
    Prefix = customer.local
    ServerVariables {
	MAGE_RUN_CODE = customer_de
	MAGE_RUN_TYPE = store
	PHP_SELF = /de/index.php
	SCRIPT_NAME = /de/index.php
    RewriteRules {
      dirindex {
        pattern = ^/(de|fr)/(.*)
        to = $1/index.php/$2
        qsa = true
        conditions {
            * {
              pattern = \.(css|js|jpg|png|gif)$
             negate = true

StaticFile {
  FilesMatch {
    * {
      pattern = .*\.(dll|exe)
      headers {
        * = Content-Disposition: attachment
  Extensions {
    woff = application/x-font-woff
    js = text/javascript
    css = text/css
    gif = image/gif
    html = text/html
    jpe = image/jpeg
    jpeg = image/jpeg
    jpg = image/jpeg
    png = image/png
    tif = image/tiff
    tiff = image/tiff
    txt = text/plain

Running Magento Enterprise Edition with Facebook HipHop HHVM



MacBook Air (MBA) Mid 2012

Virtualbox (VB): Ubuntu 12.04.2 LTS (GNU/Linux 3.2.0-23-generic x86_64) via vagrant.


MBA with Apache 2 with mod_php Version 5.3.19 with MySQL 5.5 (MAMP)

VB with fresh pulled HHVM sources with MySQL 5.5


I ran here a big customized Magento EE 1.12 store from a big Swiss scout store. A lot of custom price rules for many different groups and some fancy discount types.

URL schema is different from the official demo store:[de|fr]/index.php to map automatically different languages.

Magento Cache activated. MySQL database slightly optimized via

  • 5000 SKUs
  • 237 categories
  • 48.000 url rewrites
  • 4 store views
  • FPC disabled

Magento EE sources has been imported into the VM. Not via shared folders or NFS. There were previously some weird long request times with HHVM when using shared folders.

Compile and Download HipHop

You can use the install script for compiling and installing hiphop

But change the hiphop source in function get_hiphop_source() to the special Magento hiphop source.

Optionally: You can remove all the last lines after ## Success in the script

Official FB "How to" compile:

Prebuild packages will not work with Magento.

HHVM config.hdf

Options for the config.hdf file:

Please see the to this gist attached file hhvm.hdf.

Buggy is the PHP_SELF and SCRIPT_NAME which will not be properly set therefore hardcoded. Also the rewrite rules can be more optimized.

Magento Errors

I'm not quite sure if that is still a problem with SimpleXML or with buggy Magento code.


  • File site/app/code/core/Mage/Core/Block/Template/Facade.php every: $key = (string)$key;


  • There are also some errors in the site/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php on line 441 but that results from strange code in phtml files ... 8-)

Not every category will work but 98% of them.


Not possible due to HHVM shows this error:

Notice: Undefined index: 0 in /var/www/customer-dev/site/app/code/core/Mage/Catalog/Model/Layer/Filter/Price/Algorithm.php on line 368

There is something weird in our code base, not in HHVM.

Performance Test

Multiple shift-reloads in the FF 23 browser in two tabs. Times are approximate.

CMS Page450ms2.5s820ms
Category View [2]980ms4.6s3.5s
Product View [3]500ms-1s4.7s3.1s
Add to basket [4]1.2-2.9s8.8s5.5s
List basket [5]2.1s6.9s3.8s
List basket [6]1s5.5s2.9s
Checkout Onepage [7]690ms4.47s
Onepage SaveBilling236ms2.3s
Onepage SaveShipping251ms2.4s
Onepage SavePayment486ms3.28s
Onepage success562ms3.25s
  1. MAMP-APC runs with PHP 5.4.16
  2. containing 8 products
  3. configurable product with two options and one customer rating
  4. POST to cart with redirect to product view and listing cart content
  5. First call of the basket page
  6. Reloads
  7. Initial load of the page checkout/onepage after that normal checkout process

ab -n 20 -c 5

In both tests: PHP 5.4.16

Product View
Concurrency Level55
Time taken for tests23.229s7.334s
Complete requests2020
Failed requests00
Write errors00
Total bytes transferred22024402244160
HTML bytes transferred21936002235640
Requests per second0.86 #/sec mean2.73 #/sec mean
Time per request5807.239 ms mean1833.474 ms mean
Time per request (1)1161.448 ms366.695 ms
Transfer rate92.59 Kbytes/sec received298.83 Kbytes/sec received

(1) mean, across all concurrent requests

Category View
Concurrency Level55
Time taken for tests36.29813.682s
Complete requests2020
Failed requests00
Write errors00
Total bytes transferred20026202118440
HTML bytes transferred19937802109920
Requests per second0.55 #/sec mean1.46 #/sec mean
Time per request9074.451 ms mean3420.546 ms mean
Time per request (1)1814.890 ms684.109 ms
Transfer rate53.88 Kbytes/sec received151.20 Kbytes/sec received

(1) mean, across all concurrent requests


Missing is a test where we rely on Redis, Percona, php-fpm + nginx.

Also missing test: The HHVM should be put behind a nginx server and even here the cache should connect to Redis.

Facebook is working hard on HHVM. A lot of commits take place every day!

Big kudos to for fixing HHVM errors related to Magento!

That would be one future for PHP.