Blog tvlooy

Playing with HipHop VM

HHVM, PHP | December 01, 2012

After Facebook posted an update on HipHop VM last week I was eager to play with it. So today I did. :-)

I installed a fresh Ubuntu Server 12.04 in VirtualBox and installed HipHop like this described in the documentation.

Then, I was not sure how to get the thing up and running. Luckily Nick Veenhof wrote a blogpost about testing HHVM with Drupal. I basically took his hhvm.hdf and adapted it just a little bit. Thanks Nick! It now looks like this:

Server { Port = 80 SourceRoot = /root/drupal-7.17 } Eval { Jit = true } Log { Level = Error UseLogFile = true File = /var/log/hhvm_error.log Access { * { File = /var/log/hhvm_access.log Format = %h %l %u %t "%r" %>s %b } } } VirtualHost { * { Pattern = .* RewriteRules { dirindex { pattern = ^/(.*)/$ to = $1/index.php qsa = true } } } } StaticFile { FilesMatch { * { pattern = .*.(dll|exe) headers { * = Content-Disposition: attachment } } } Extensions { 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 } }

I started HHVM like this:

dev/hiphop-php/src/hhvm/hhvm --config hhvm.hdf --user root --mode daemon \ -v "Log.Level=Verbose" -v "Log.NoSilencer=on" -v "Log.Header=on"

Next, I set up an empty Symfony2 and Drupal7 project and started watching the /var/log/hhvm_error.log

Unlike Nick, I didn’t have trouble with MySQL / PDO (maybe because I compiled myself and Nick used the package). I looked into the github account and I think they actually do support MySQL and PDO.

I was unable to get Symfony2 nor Drupal7 up and running but I made it to their "config" pages after hacking some things out. For example, this was from the hhvm_error.log:

[Sat Dec 1 20:21:05 2012] [hphp] [18496:52aee700:10:000003] [] HipHop Fatal error: f_get_cfg_var is not going to be supported: global configurations not used in /root/Symfony2/app/SymfonyRequirements.php on line 366 [Sat Dec 1 20:36:20 2012] [hphp] [18890:54ff1700:4:000004] [] HipHop Fatal error: f_stream_get_wrappers is not going to be supported: stream protocol is not supported in /root/drupal-7.17/includes/ on line 133 [Sat Dec 1 20:37:42 2012] [hphp] [18890:53ed6700:2:000004] [] HipHop Fatal error: f_stream_wrapper_register is not going to be supported: stream protocol is not supported in /root/drupal-7.17/includes/ on line 146

Here’s a screenshot of the Symfony2 and Drupal7 config page:

Symfony2 on HHVM
Drupal7 on HHVM

I was just playing around a bit and wanted to share the experience. I'm sure you can get this a bit further. Let me now if you do!