Skip to main content

First steps with hhvm (revisited)

This blog post might be outdated!
This blog post was published more than one year ago and might be outdated!
· 2 min read
Stephan Hochdörfer
Head of IT Business Operations

I recently published a blog post on how to set-up HHVM in a virtual machine. Since the latest HHVM release a few things changed within HHVM and you won't be able to install HHVM that way. This blog post will give you some insights on how to install the current version of HHVM.

First of all let's set-up a VM with Debian 7 via vagrant:

Vagrant.configure("2") do |config|
config.vm.define "box" do |box_cfg| = 'debian-wheezy'
box_cfg.vm.box_url = ''
box_cfg.vm.hostname = "hhvm"

# Forward a port from the guest to the host :forwarded_port, guest: 80, host: 8080

# share folder to the guest VM
box_cfg.vm.synced_folder ".", "/vagrant", owner: "www-data", group: "vagrant"

Installing hhvm on a Debian Wheezy box is pretty straight forward. Since the "official" hhvm binaries do not contain a webserver anymore we need to install any webserver with Fast-CGI support. In this case we go for nginx. It boils down to the following commands which you need to execute as root user:

wget -O - | apt-key add -
echo deb wheezy main | sudo tee /etc/apt/sources.list.d/hhvm.list
apt-get update
apt-get install hhvm-fastcgi nginx

Now we need to configure Fast-CGI support of nginx and point it to the local hhvm installation. The hhvm folks ship an installer for that purpose to make it really easy for us to set things up. Just run the following commands as root user:

sudo /usr/share/hhvm/
sudo /etc/init.d/nginx restart
sudo /etc/init.d/hhvm restart

Last not least we create an index.php file which should be served by hvvm. Create the file in /usr/share/nginx/www. Let's go for a simple "Hello world!" script like this:

echo "Hello world!";

That's all we need. Now point your webbrowser to http://localhost:8080/index.php and you should be able see the "Hello world!" greeting. That was easy ;)