(Dec 29) New version 0.9.8-18 has been released

HHVM template research thread

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Forum rules
Before creating a new topic or reply on the forum you should fill out additional fields "Os" and "Web" in your profile section.
In case of violation, the topic can be closed or response from the support will not be received.
zorrobyte
Posts: 7
Joined: Sun Apr 26, 2015 2:34 pm

HHVM template research thread

Postby zorrobyte » Sun Apr 26, 2015 2:50 pm

Greetings!

HHVM is a super fast PHP and HACK language JIT compiler which replaces the PHP runtime.It can often be 2x faster then PHP 5.6 with OpCache enabled: https://kinsta.com/blog/real-world-word ... -and-hhvm/

This is how you install it on Ubuntu:

Code: Select all

Ubuntu 12.04:
$ sudo add-apt-repository -y ppa:mapnik/boost
$ wget -O - http://dl.hhvm.com/conf/hhvm.gpg.key | sudo apt-key add -
$ echo deb http://dl.hhvm.com/ubuntu precise main | sudo tee /etc/apt/sources.list.d/hhvm.list
$ sudo apt-get update
$ sudo apt-get install -y hhvm


Ubuntu 14.04:
$ wget -O - http://dl.hhvm.com/conf/hhvm.gpg.key | sudo apt-key add -
$ echo deb http://dl.hhvm.com/ubuntu trusty main | sudo tee /etc/apt/sources.list.d/hhvm.list
$ sudo apt-get update
$ sudo apt-get install -y hhvm


Install script:

Code: Select all

sudo /usr/share/hhvm/install_fastcgi.sh


Run HHVM at boot:

Code: Select all

sudo update-rc.d hhvm defaults


Use HHVM at the command line instead of PHP (optional)

Code: Select all

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


I took the advise in viewtopic.php?f=11&t=5830 and instead of modifying the default.tpl profile (which breaks phpmyadmin), but I copied (as phpmyadmin breaks if in default and I don't want default running HHVM):

/usr/local/vesta/data/templates/web/nginx/default.tpl --> /usr/local/vesta/data/templates/web/nginx/hhvm.tpl
/usr/local/vesta/data/templates/web/nginx/hhvm.stpl -> /usr/local/vesta/data/templates/web/nginx/hhvm.stpl

and then added the tweaks from https://github.com/facebook/hhvm/issues/3472

**Apache Config Guide**

https://github.com/facebook/hhvm/wiki/FastCGI says we need mod_proxy mod_proxy_fcgi, so:

Code: Select all

sudo a2enmod proxy_fcgi
(this enables mod_proxy automatically as a dependency)

cp /usr/local/vesta/data/templates/web/apache2/default.tpl /usr/local/vesta/data/templates/web/apache2/hhvm.tpl
cp /usr/local/vesta/data/templates/web/apache2/default.stpl /usr/local/vesta/data/templates/web/apache2/hhvm.stpl

Add

Code: Select all

   ProxyPass / fcgi://127.0.0.1:9000/%docroot%/
   # Or if you used a unix socket
   # ProxyPass / unix://var/run/hhvm/sock|fcgi://127.0.0.1:9000/path/to/your/www/root/goes/here/
   <Directory %docroot%>
      DirectoryIndex index.php
   </Directory>


To each hhvm.tpl & hhvm.stpl

You'll also want to:

Code: Select all

rm /etc/apache2/mods-enabled/hhvm_proxy_fcgi.conf

As this file overrides the vhost config: https://github.com/facebook/hhvm/issues/3472

Now you can select your new HHVM template(s) in VestaCP under Packages or Host config!

bestony
Posts: 17
Joined: Sat Mar 07, 2015 5:22 pm
Contact:

Re: HHVM template research thread

Postby bestony » Sun Apr 26, 2015 7:47 pm

Good~!

Yikmings
Posts: 16
Joined: Fri Nov 22, 2013 4:51 pm

Re: HHVM template research thread

Postby Yikmings » Fri May 01, 2015 12:59 pm

Great and thanks for sharing.

estreetz
Posts: 2
Joined: Sat Aug 29, 2015 5:37 pm

Re: HHVM template research thread

Postby estreetz » Sat Aug 29, 2015 5:42 pm

Hi,

I try your tutorial, it's work good with varnish
but i cannot use mod_rewrite on wordpress i got error 404
Did you have a idea ?

Thank You


Return to “Web Server”



Who is online

Users browsing this forum: No registered users and 3 guests