How to Install HHVM (HipHop Virtual Machine) on Ubuntu 14.04 using Apache or Nginx

Brendan Bonner
by (39posts) under Cloud Hosting
Verified and Tested 8/5/15


This guide will show you how to install HHVM (HipHop Virtual Machine) on an Ubuntu 14.04 server using Apache or Nginx. HHVM is a process virtual machine designed to execute Hack and PHP programs. HHVM runs programs at run time rather than prior, which gives HHVM high-caliber performance over a typical PHP install. HHVM was open-sourced and developed by Facebook.


– A server with Ubuntu 14.04 installed. HHVM requires the 64-bit version.  If you do not have a server, try a market-leading Cloud Server in under 30 seconds from Atlantic.Net

– Apache or Nginx installed on your server. You can follow our guides on installing Apache or Nginx if needed.

Installing HHVM on Ubuntu 14.04 using Apache or Nginx

First we need to add the HHVM key to your Ubuntu Server with the following command:

sudo wget -O - | apt-key add -

Next we are going to add the HHVM source to your sources list with the following command:

sudo echo deb trusty main | sudo tee /etc/apt/sources.list.d/hhvm.list

Now that we added the key and sources it is a good idea to run and update with the following command:

sudo apt-get update

Now we can install HHVM with the following command:

sudo apt-get install hhvm

Make it start on boot by running the command:

sudo update-rc.d hhvm defaults

HHVM includes an excellent script to install FastCGI based on web server you have installed. Run it with the following command:

sudo /usr/share/hhvm/

Note: On Apache there have been issues with hhvm_proxy_fcgi.conf not matching the default directory and when you access PHP sites you get a 404 File Not Found. To fix this, use your favorite text editor open the following file:


Within the file find the line that says:

proxypassmatch ^/(.+\.(hh|php)(/.*)?)$ fcgi://$1

Then replace it with the following:

ProxyPassMatch ^/(.+\.(hh|php)(/.*)?)$ fcgi://$1

You can now test it by making a sample PHP page and going to your web browser.

For Nginx open your editor and create the file:


For Apache open your editor and create the file:


Then add the following code to your new file.

php phpinfo();

Now test it by opening up your web browser and going to

You should get a page similar to the one below.

An example of the HHVM info page

An example of the HHVM info page

It is a good idea to delete your info.php file as it could be used to attack your server.

Sample Commands for HHVM you may find useful

Start HHVM with:

service hhvm start

Stop HHVM with:

service hhvm stop

Restart HHVM with:

service hhvm restart

You can also see if HHVM is version with the following command:

hhvm --version

What’s Next?

Congratulations on installing HHVM on Ubuntu 14.04. Try it out with some of your favorite CMS’s like WordPress or Drupal and you should see a performance increase especially under load. Thank you for following along this how to, please check back for more updates.


Related Posts

New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

Dallas, TX

2323 Bryan Street,

Dallas, Texas 75201

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4