How to install HHVM on Ubuntu Linux

|

,

|

The LAMP stack, a widely used stack, can be enhanced by using HHVM instead of PHP for improved performance. This tutorial guides users on installing HHVM on Ubuntu systems to operate WordPress and other PHP-based content management systems. It provides step-by-step instructions on adding the HHVM repository to Ubuntu, managing the HHVM service, and testing…

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.

HHVM is an open-source virtual machine designed for executing programs and applications written in PHP. It is an alternative to PHP of the LAMP stack and can be used to achieve superior performance.

Installing HHVM on Ubuntu can improve the performance of WordPress and other content management systems based on PHP. As Ubuntu is a popular and widely used operating system, installing HHVM on Ubuntu can benefit many users who want to optimize their website’s performance.

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 them, the commands below can be used to stop and start, enabling them always to start 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:

Like this:



Leave a Reply

Your email address will not be published. Required fields are marked *

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