Tools Blog Learn Quizzes Smile API Log In / Sign Up
Tools Blog Learn Quizzes Smile API Log In / Sign Up
« Return to the tutorials list
We have updated the website and our policies to make sure your privacy rights and security are respected.
Click here to learn more about the way our website handles your data.

Remove this message.

A 3 step tutorial on how to install HHVM with Apache FastCGI on Ubuntu 13.10

Difficulty: 50 / 50 Tweet

Today we're going to learn how to install Facebook's HHVM (HIP HOP VIRTUAL MACHINE) and make it work together with the Faster CGI module in Apache. Basically what is going to happen is Apache will be handling all the static content and we will let HHVM do what it does best - handle PHP or hack!

For those of you who don't know this yet, HHVM is a super fast way of interpreting PHP code. What HHVM does is it compiles PHP code into a byte code language, very close to native code and stores it into an sqlite database file. This will make your website super fast!

Step 1:

Head over to Digital Ocean and get a $5/Month server. It features 512MB of RAM / 1 CPU, 20GB SSD DISK and 1TB TRANSFER. Once you have installed your droplet you need to connect to it as root by using your favorite ssh client.

Step 2:

Second step is to to install the LAMP server and the fastest way to do so is using the tasksel application on Ubuntu. To test the installation, just access the server IP from your browser.

Step 3:

Once you have LAMP running, install HHVM and then execute the bash script that links Apache and HHVM through the Faster CGI module. Then you can uninstall php.

Here's the full list of commands that need to be run:

  
    # first install your lamp server
    root@yourserver [~]# tasksel install lamp-server
    # then get the repos to be able to install hhvm through apt-get
    wget -O - http://dl.hhvm.com/conf/hhvm.gpg.key | sudo apt-key add -
    echo deb http://dl.hhvm.com/ubuntu saucy main | sudo tee /etc/apt/sources.list.d/hhvm.list
    # then update your local repo database
    apt-get update
    # then install hhvm
    apt-get install hhvm
    # once you've finished intalling you should run the bash script that comes with the package to make apache work well with HHVM
    /usr/share/hhvm/install_fastcgi.sh
    # at the end, if you want you can remove PHP
    apt-get remove php*
    #BOOM - You're done
  
comments powered by Disqus