We are going to speed up our existing php application by using HHVM. HHVM is a virtual machine designed for executing the program by using Just-in-time(JIT) compilation approach. It is a new techology which is used by Facebook.Also it help us to achieve the superior performance. It is an Open Source at Facebook. Also HHVM has realized over a 9x increase in web request throughput and over a 5x reduction in memory consumption for Facebook compared with the PHP 5.2 engine + APC
If you’re using HHVM to run web scripts, you probably want it to start at boot:
sudo update-rc.dhhvm defaults
That’s it. We have done HHVM installation. Now, We are going to configure with nginx by using to run following command in terminal
By running this command it creates hhvm.conf file inside the /etc/nginx/ directory and also it adds include hhvm.conf line in every server block of your default file in /etc/nginx/sites-available/ .Now if there is no default file in /etc/nginx/sites-available/ then the inlcude lines are not added in server blocks.You will have to add them manually.You should check the files inside /etc/nginx/sites-available/ and add below lines any where inside Server block.
Make sure hhvm.conf(/etc/nginx/hhvm.conf) should has following lines
Finally, We restart the nginx and hhvm by using following command
sudo service hhvm restart
sudo service nginx restart
You can also test if Nginx is using HHVM or not.To test just create a file hhvm.php in /usr/share/nginx/html .After creating that write below code in it
echo'Hip Hop Virtual Machine is working';
echo'Hip Hop Virtual Machine is not working';
Now open the file in browser (your-domain-name.com/hhvm.php).You can see the output Hip Hop Virtual Machine is working.If the output is Hip Hop Virtual Machine is not working then you check the errors in HHVM log files or Nginx log files.Nginx log files are located in /var/log/nginx directory.
HHVM Performance status
I hope this will help to my blog readers. You can try it with existing or new development application. Thank you.