How to Install HHVM on Ubuntu Linux

office 4694143 640
office 4694143 640

The LAMP stack consists of Linux, Apache2, MySQL or MariaDB, and PHP. It’s an open-source stack that powers most websites and applications online today.

One popular alternative to PHP of the LAMP stack is HHVM. HHVM is an open-source virtual machine designed for executing programs and applications written in PHP. You can use HHVM in place of PHP of the LAMP stack to achieve superior performance.

This brief tutorial will show students and new users how to install HHVM on Ubuntu systems to run WordPress and other content management systems based on PHP.

To get started with installing HHVM on Ubuntu, follow the guide below.

Add HHVM repository to Ubuntu

First, run the commands below to download the repository key on Ubuntu.

sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449

Then run the commands below to add its repository to the Ubuntu system.

sudo add-apt-repository "deb http://dl.hhvm.com/ubuntu $(lsb_release -sc) main"

The above step will prepare the application to be installed on Ubuntu.

Install HHVM

Now that the repository and key have been added to Ubuntu, run the commands below to install HHVM.

sudo apt-get update
sudo apt-get install hhvm

After installing hhvm, the commands below can be used to stop, start and enable hhvm always to start up when the server boots.

sudo systemctl stop hhvm.service
sudo systemctl start hhvm.service
sudo systemctl enable hhvm.service

Next, run the commands below to make HHVM answer all PHP calls even if php-cli is installed. In some cases, php-cli may conflict with HHVM.

sudo /usr/bin/update-alternatives --install /usr/bin/php php /usr/bin/hhvm 60

After running the commands above, HHVM should be installed and ready to use. To test the HHVM installation, run the commands below. To view the test from your browser, you must have Nginx or Apache2 installed.

sudo echo "<?php phpinfo(); ?>" > /var/www/html/info.php

When you browse your server, followed by info.php, you should see the test page with HHVM info.

Enjoy!~

You may also like the post below:

Posted by
Richard W

I love computers; maybe way too much. What I learned I try to share at geekrewind.com.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: