Skip to content

Instantly share code, notes, and snippets.

@gondo
Forked from SchumacherFM/Magento-HHVM.md
Created August 17, 2013 03:15
Show Gist options
  • Select an option

  • Save gondo/6255074 to your computer and use it in GitHub Desktop.

Select an option

Save gondo/6255074 to your computer and use it in GitHub Desktop.
PidFile = /tmp/hhvm.pid
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_IS_DEVELOPER_MODE = true
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
}
}
#!/bin/bash
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

Running Magento Enterprise Edition with Facebook HipHop HHVM

Prerequisites

I ran a big customized Magento EE store from a big Swiss scout store.

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

Ubuntu 12.04.2 LTS (GNU/Linux 3.2.0-23-generic x86_64) in a virtualbox via vagrant.

Magento Cache activated. MySQL database slightly optimized via mysqltuner.pl

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

Magento EE sources has been imported into the VM. Not via shared folders or NFS.

Compile and Download HipHop

Use can use that install script install-hhvm.sh for compiling and installing hiphop https://github.com/jakoch/php-hhvm.

But change the hiphop source in function get_hiphop_source() to the special Magento hiphop https://github.com/danslo/hiphop-php source.

Optionally: You can remove all the last lines after ## Success in the script install-hhvm.sh.

Official FB "How to" compile: https://github.com/facebook/hiphop-php/wiki

Prebuild packages will not work with Magento.

HHVM config.hdf

Options for the config.hdf file: https://github.com/facebook/hiphop-php/blob/master/hphp/doc/options.compiled

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

Magento Errors

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

Fixes:

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

Unfixable:

  • 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 ...

Therefore I could test all except displaying product list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment