HHVM is all called HipHop virtual machine, an open-source VM that is used to run applications developed by Hack (a programming language) and PHP. HHVM has achieved extraordinary performance by using the latest compilation methods, with the highest flexibility required by PHP programmers. So far, compared to PHP + APC (alternative php Cache), HHVM has increased the performance of FaceBook by 9 times times the throughput of HTTP requests, reducing memory usage by about 5 times times the memory footprint.
At the same time, HHVM can work with FastCGI-based WEB servers such as Nginx or Apache.
In this tutorial, we will configure the Nginx/apache Web server, database server MariaDB, and HHVM together. We will use Ubuntu 15.04 (64-bit) because the HHVM can only be run on a 64-bit system. At the same time, this tutorial is also available for Debian and Linux Mint.
First step: Install Nginx or Apache server
1, first of all, first to upgrade the system and update the list of software warehouses, the command is as follows
# apt-get update && Apt-get upgrade
2, as I said before, HHVM can be integrated with Nginx and Apache. So, it's your freedom to actually use which server, but we'll teach you how to install both servers.
Installing Nginx
We install the Nginx/apache server with the following command
# Apt-get Install Nginx
Installing Apache
# Apt-get Install Apache2
To complete this step, you can see the default page of Nginx or Apache via the following link:
localhost
Or
Ip-address
Step Two: Install and configure MariaDB
3, this step, we will install MariaDB by the following command, it is a better performance than MySQL database
# apt-get Install mariadb-client Mariadb-server
4, after the successful installation of MariaDB, you can start it, and set the root password to protect the database:
# systemctl start MySQL
# mysql_secure_installation
To answer the following questions, just press Y or N and enter. Please make sure you read the instructions carefully.
Enter current password to root (enter for none) = Press ENTER
Set root Password? [y/n] = Y
Remove anonymous users[y/n] = y
Disallow root login remotely[y/n] = y
Remove test database and access to it [y/n] = y
Reload privileges Tables now[y/n] = y
5. After setting the password, you can log in to MariaDB.
# mysql-u Root-p
Step Three: Install HHVM
6, at this stage, we will install HHVM. We need to add the HHVM repository to your sources.list file and then update the software list.
# Wget-o-Http://dl.hhvm.com/conf/hhvm.gpg.key | Apt-key Add-
# echo Deb Http://dl.hhvm.com/ubuntu distribution_version main | sudo tee/etc/apt/sources.list.d/hhvm.list
# Apt-get Update
Important: Don't forget to replace the above distribution_version with your Ubuntu distribution code (e.g. lucid, precise, trusty) or Debian Jessie or wheezy. The same is true for Linux Mint, but only supports Petra.
Once you have added the HHVM warehouse, you can easily install it.
# Apt-get Install-y HHVM
Once installed, it can be started, but it does not boot up. You can use the following command to start the boot.
# UPDATE-RC.D HHVM Defaults
Fourth step: Configure the Nginx/apache connection HHVM
7. Now, Nginx/apache and HHVM have been installed and are all running independently, so we need to set them up to correlate with each other. The key step is to tell Nginx/apache to give all of the PHP files to HHVM for processing.
If you use Nginx, please follow the steps below:
Nginx configuration files are in/etc/nginx/sites-available/default, and these profiles will look for file execution in/usr/share/nginx/html, but it does not know how to handle PHP.
To ensure that Nginx can connect to HHVM, we need to execute the following script. It can help us to properly configure Nginx, put hhvm.conf to the header of the configuration file nginx.conf mentioned above.
This script ensures that Nginx can properly handle. HH and. PHP and send them to HHVM via fastcgi.
#/usr/share/hhvm/install_fastcgi.sh
Important: If you are using Apache, you do not need to configure it here.
8. Next, you need to use HHVM to provide PHP's operating environment.
#/usr/bin/update-alternatives--install/usr/bin/php PHP/USR/BIN/HHVM 60
Once the above steps are complete, you can now start and test it.
# Systemctl Start HHVM
Fifth step: Test HHVM and Nginx/apache
9. In order to confirm whether the HHVM is working, you need to establish hello.php in the Nginx/apache document root directory.
# nano/usr/share/nginx/html/hello.php [For Nginx]
Or
# nano/var/www/html/hello.php [For Nginx and Apache]
Add the following code to the file:
<?php
if (defined (' hhvm_version ')) {
Echo ' HHVM is working ';
Phpinfo ();
} else {
Echo ' HHVM is not working ';
}
?>
Then visit the link below to confirm if you can see "Hello World"
localhost/info.php
Or
ip-address/info.php
If the "HHVM" page appears, it means you've succeeded.
Conclusion
The above steps are very simple, I hope you can feel that this is a useful tutorial.
Free pick up brother even it education original Linux OPS engineer video/Detailed Linux tutorials, details Inquiry official website customer Service: http://www.itxdl.cn/linux/
or hooking up with Q2430675018.
Welcome to the Linux Communication Group 478068715
Configure a high-performance HHVM environment on Ubuntu