The LAMP stack consists of Linux, Apache2, MySQL or MariaDB, and PHP. It’s an open-source stack that powers the majority of the 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 is going to 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"
Doing the above step will get the application ready to be installed on Ubuntu.
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 to always 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.
You may also like the post below: