Search This Blog

Showing posts with label HHVM. Show all posts
Showing posts with label HHVM. Show all posts

Friday, July 21, 2017

HHVM Tuning


  • Disabling The Typechecker:

HHVM automatically runs the typechecker - this is useful in development, but assuming you have it running in your development workflow and in your CI system, there is not much additional benefit to running it in production, and the increased memory usage can be costly in production. To disable it, add the following to /etc/hhvm/server.ini:

hhvm.hack.lang.auto_typecheck=0
hhvm.hack.lang.look_for_typechecker=0


Reference:
https://hub.docker.com/r/hhvm/hhvm-proxygen/


  • Switch to UNIX socket inside of port for fastcgi mode:

HHVM is considered for environments under heavy load so the first configuration change you can do is to make HHVM listen to a socket instead of a TCP port. Thus, the communication between Nginx and HHVM will require less CPU and memory.

Add this to: /etc/hhvm/server.ini

hhvm.server.file_socket=/var/run/hhvm/hhvm.sock
; hhvm.server.port = 9000


I also common out the port line to increase a bit of security.

Then change the Nginx config to hhvm as well:
/etc/nginx/hhvm.conf

fastcgi_pass unix:/var/run/hhvm/hhvm.sock;



  • Tweaking Memory:


By default the memory_limit is equal to 17179869184 bytes, which is 16 GB.
Such a high memory resource limit will certainly kill a server with a few GB of RAM, making it unresponsive.
I decrease this value to 500 MB for a 1 GB memory Server:

Add this to: /etc/hhvm/php.ini

memory_limit = 500M


Restart to apply the changes:

service hhvm restart
service nginx restart


Reference:
https://www.digitalocean.com/community/tutorials/how-to-install-hhvm-with-nginx-on-ubuntu-14-04


  • A much more pushed example for a bigger server:



; php options
pid = /var/run/hhvm/hhvm.pid

; hhvm specific
; hhvm.server.port = 9000
hhvm.server.file_socket= /var/run/hhvm/hhvm.sock
hhvm.server.type = fastcgi
hhvm.server.default_document = index.php

; logging settings
hhvm.log.use_log_file = true
hhvm.log.file = /var/log/hhvm/error.log
hhvm.log.header = true
hhvm.log.level = Warning
hhvm.log.always_log_unhandled_exceptions = true
hhvm.log.runtime_error_reporting_level = 8191

hhvm.mysql.typed_results = false
hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc
hhvm.server.source_root = /var/www/html

; php compatibility
hhvm.server.allow_duplicate_cookies = 0
hhvm.enable_obj_destruct_call = 1
hhvm.enable_zend_sorting = 1
hhvm.enable_zend_compat = 1

; logging
hhvm.log.admin_log.file = /var/log/hhvm/admin.log

; admin server

hhvm.admin_server.password = xxx

hhvm.admin_server.port = 8088
hhvm.admin_server.thread_count = 1

; required for magento2
hhvm.libxml.ext_entity_whitelist = "file"

; apc
hhvm.server.apc.enable_apc = true

; jit
hhvm.jit = true
hhvm.jit_warmup_requests = 5

; debugger
hhvm.debugger.enable_debugger = false
hhvm.debugger.enable_debugger_server = false
hhvm.debugger.default_sandbox_path = /var/www/html


hhvm.enable_zend_ini_compat = false

 hhvm.jit_a_cold_size=201326592
 hhvm.jit_a_frozen_size=201326592
 hhvm.jit_a_size=201326592
 hhvm.jit_global_data_size=201326592
 hhvm.mysql.connect_timeout=6000
 hhvm.repo.central.file_group=www-data
 hhvm.repo.central.file_user=www-data
 hhvm.server.connection_timeout_seconds=300
 hhvm.server.implicit_flush=1
 hhvm.server.request_timeout_seconds=300
 hhvm.server.thread_count=10000


Reference:
https://github.com/facebook/hhvm/issues/7754

Friday, February 24, 2017

HHVM 3.18.0 crash on Ubuntu 16.04 with Nginx

Just try to bring up an new HHVM host on Ubuntu 16.04 with Nginx.

But HHVM keep crush error in /var/log/hhvm/error.log
It created error log in /tmp

Here is a example:


ProcessID: 1549
ThreadID: 140594705856256
ThreadPID: 2188
Name: unknown program
Type: Aborted
Runtime: hhvm
Version: tags/HHVM-3.18.0-0-g9b285191feb2bb1558bb6682da135263bd2a9e60
DebuggerCount: 0

ThreadType: Web Request
Assertion Message: Failed to initialize central HHBC repository:
Failed to initialize schema in /var/run/hhvm/hhvm.hhbc(rw-r--r-- root:root):
Failed to open /var/www/.hhvm.hhbc: 14 - unable to open database file

Assertion Failure: /tmp/tmp.Fv54re7NgD/hphp/runtime/vm/repo.cpp:562: HPHP::Repo::initCentral()::__lambda62: assertion `false' failed.
URL: /wp-admin/admin-ajax.php



Run ls -alt /var/run/hhvm
Since upgrading to 3.18, hhvm is unable to open hhvm.hhbc as it is created as root instead of www-data.

For now the workaround is to add the following to your configuration: /etc/hhvm/server.ini


hhvm.repo.central.file_user=www-data
hhvm.repo.central.file_group=www-data
hhvm.repo.central.file_mode=493



Restart the HHVM service.

And it works.

Hope HHVM team can fix it in the next release.


Reference: https://github.com/facebook/hhvm/issues/7674

Thursday, June 30, 2016

Nginx and HHVM always return a 404

This because the /etc/nginx/hhvm.conf did not load before the root in vhost.

This is just a quick notice for myself, I will add more example later:

3 fix solutions:

1.move root out of /

server {
listen 443 ssl http2;

root /var/www/default/public;

location / {
index index.html index.htm;
include hhvm.conf;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/default/public;
}


OR:

server {
listen 443 ssl http2;

location / {
root /var/www/default/public;
index index.html index.htm;
include hhvm.conf;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/default/public;
}


2.move hhvm into /

server {
listen 80;
server_name localhost;
root /var/www/html;

include hhvm.conf;
# put hhvm.conf out of location /

#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;

location / {
index index.html index.htm;
}


3.add /var/www replace $doc_root

location ~ \.(hh|php)$ {
fastcgi_keep_conn on;
# I use UNIX socket inside of local port for better security and performance since both Nginx and HHVM on same Server
# fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/hhvm/hhvm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name;
include fastcgi_params;
}


My /etc/nginx/hhvm.conf file:

location ~ \.(hh|php)$ {
fastcgi_keep_conn on;
# I use UNIX socket inside of local port for better security and performance since both Nginx and HHVM on same Server
# fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/hhvm/hhvm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}


Reference:

    http://stackoverflow.com/questions/28308099/nginx-and-hhvm-always-return-a-404

Saturday, June 11, 2016

HHVM 3.14 update missing error while loading shared libraries: libdouble-conversion.so.1 and liblz4.so.1

One of my Ubuntu 14.04 LTS server running HHVM for a while.
Recently the 3.14 update just came, after upgrade the HHVM won't start:


root@milliondollarserver:~# apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
hhvm
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 18.6 MB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://dl.hhvm.com/ubuntu/ trusty/main hhvm amd64 3.14.0~trusty [18.6 MB]
Fetched 18.6 MB in 1s (10.3 MB/s)
(Reading database ... 92960 files and directories currently installed.)
Preparing to unpack .../hhvm_3.14.0~trusty_amd64.deb ...
********************************************************************
* HHVM is being removed. You can remove it from your webserver with:
*
* $ sudo /usr/share/hhvm/uninstall_fastcgi.sh
* $ sudo /etc/init.d/nginx restart
* $ sudo /etc/init.d/apache restart
********************************************************************
Unpacking hhvm (3.14.0~trusty) over (3.13.2~trusty) ...
Processing triggers for ureadahead (0.100.0-16) ...
ureadahead will be reprofiled on next reboot
Setting up hhvm (3.14.0~trusty) ...
update-alternatives: using /usr/bin/hhvm to provide /usr/bin/php (php) in auto mode
********************************************************************
* HHVM is installed.
*
* Running PHP web scripts with HHVM is done by having your
* webserver talk to HHVM over FastCGI. Install nginx or Apache,
* and then:
* $ sudo /usr/share/hhvm/install_fastcgi.sh
* $ sudo /etc/init.d/hhvm restart
* (if using nginx) $ sudo /etc/init.d/nginx restart
* (if using apache) $ sudo /etc/init.d/apache restart
*
* Detailed FastCGI directions are online at:
* https://github.com/facebook/hhvm/wiki/FastCGI
*
* If you're using HHVM to run web scripts, you probably want it
* to start at boot:
* $ sudo update-rc.d hhvm defaults
*
* Running command-line scripts with HHVM requires no special setup:
* $ hhvm whatever.php
*
* You can use HHVM for /usr/bin/php even if you have php-cli
* installed:
* $ sudo /usr/bin/update-alternatives \
* --install /usr/bin/php php /usr/bin/hhvm 60
********************************************************************
/usr/bin/hhvm: error while loading shared libraries: libdouble-conversion.so.1: cannot open shared object file: No such file or directory
root@milliondollarserver:~# service hhvm restart
* Restarting HHVM FastCGI Daemon hhvm
/usr/bin/hhvm: error while loading shared libraries: libdouble-conversion.so.1: cannot open shared object file: No such file or directory


Than I installed the libdouble-conversion library:

root@milliondollarserver:~# apt-cache search libdouble
libdouble-conversion1 - routines to convert IEEE floats to and from strings
libdouble-conversion-dbg - routines to convert IEEE floats to and from strings (debugging symbols)
libdouble-conversion-dev - routines to convert IEEE floats to and from strings (development files)
root@milliondollarserver:~# apt-get install libdouble-conversion1
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
libdouble-conversion1
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 31.5 kB of archives.
After this operation, 104 kB of additional disk space will be used.
Get:1 http://ca.archive.ubuntu.com/ubuntu/ trusty/universe libdouble-conversion1 amd64 2.0.1-1 [31.5 kB]
Fetched 31.5 kB in 0s (96.7 kB/s)
Selecting previously unselected package libdouble-conversion1:amd64.
(Reading database ... 92960 files and directories currently installed.)
Preparing to unpack .../libdouble-conversion1_2.0.1-1_amd64.deb ...
Unpacking libdouble-conversion1:amd64 (2.0.1-1) ...
Setting up libdouble-conversion1:amd64 (2.0.1-1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.9) ...


But still no luck:

root@milliondollarserver:~# service hhvm start
/usr/bin/hhvm: error while loading shared libraries: liblz4.so.1: cannot open shared object file: No such file or directory
root@milliondollarserver:~# service hhvm restart
* Restarting HHVM FastCGI Daemon hhvm
/usr/bin/hhvm: error while loading shared libraries: liblz4.so.1: cannot open shared object file: No such file or directory


I have to install liblz4 to fix it:


root@milliondollarserver:~# apt-cache search liblz4
liblz4-1 - Fast LZ compression algorithm library - runtime
liblz4-1-dbg - Fast LZ compression algorithm library - Debugging Symbols
liblz4-dev - Fast LZ compression algorithm library - development files
liblz4-tool - Fast LZ compression algorithm library - tool
root@milliondollarserver:~# apt-get install liblz4-1
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
liblz4-1
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 16.1 kB of archives.
After this operation, 72.7 kB of additional disk space will be used.
Get:1 http://ca.archive.ubuntu.com/ubuntu/ trusty/universe liblz4-1 amd64 0.0~r114-2ubuntu1 [16.1 kB]
Fetched 16.1 kB in 0s (55.5 kB/s)
Selecting previously unselected package liblz4-1:amd64.
(Reading database ... 92966 files and directories currently installed.)
Preparing to unpack .../liblz4-1_0.0~r114-2ubuntu1_amd64.deb ...
Unpacking liblz4-1:amd64 (0.0~r114-2ubuntu1) ...
Setting up liblz4-1:amd64 (0.0~r114-2ubuntu1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.9) ...
root@milliondollarserver:~# service hhvm start


I noticed my Debian 8 Jessie server doesn't have this issue, only the Ubuntu 14.04 LTS.

Just a heads up for every one test your code and server before you upgrade the production system.

I like (not love anymore, since version 3.10) HHVM, but it got some quality issues since Version 3.10.
Hope it just a temporary thing.

I will keep support HHVM but not suggest it in production system.


Have a nice weekend!

Thursday, March 31, 2016

HHVM Segfault since latest update (3.13.0) switch to LTS 3.12.1

Today is March 31, 2016.
Just upgrade the HHVM to latest update 3.13.0.

Then my blog start to crash, restart the HHVM service several times, No help.
Check the log and debug into No help.

HHVM's Github support also reporting similar issue:
https://github.com/facebook/hhvm/issues/6950

So I switch to the latest LTS which is 3.12.1 at this moment.
https://docs.hhvm.com/hhvm/installation/linux

First I backup my own HHVM config file:

cp /etc/hhvm/* ~/hhvm_backup/
cp /etc/init.d/hhvm ~/hhvm_backup/init_hhvm
cp -r /etc/nginx/* ~/hhvm_backup/nginx


Then clean up the 3.13.0 package:

apt-get purge hhvm
apt-get autoremove
apt-get clean all


Put new apt config file: /etc/apt/sources.list.d/hhvm.list

deb http://dl.hhvm.com/debian jessie-lts-3.12 main


Install the latest LTS HHVM:

apt-get update
apt-get install hhvm
/usr/share/hhvm/install_fastcgi.sh


Recover my backup config file:

cp server.ini /etc/hhvm/
cp hhvm.conf /etc/nginx/hhvm.conf


Start the service:

service hhvm restart
service nginx restart



And I am back.

I love hhvm, but you better stay on LTS for production level service or system.

Have a nice day!



Update April 4th, 2016:

My HHVM 3.12.1 just crash, but a restart service make it stable for next few days.

It seems there are 2 tweaks you can try:

1.Maybe usefull: When the daemon is started via systemctl it dies after some requests. It will runs if run by:
hhvm -m server -c /etc/hhvm/server.ini


2.Changing /etc/hhvm/php.ini using hhvm.log.level = Error
; hhvm specific
;hhvm.log.level = Warning
hhvm.log.level = Error


Reference: https://github.com/facebook/hhvm/issues/6950

I also add these line in my /etc/hhvm/php.ini
; mysql
hhvm.mysql.socket = /var/run/mysqld/mysqld.sock
hhvm.pdo_mysql.socket = /var/run/mysqld/mysqld.sock
hhvm.mysqli.socket = /var/run/mysqld/mysqld.sock

Friday, November 14, 2014

Magento on HHVM 3.3 Nginx 1.6 on Ubuntu 14.04 trusty

No more Varnish! Love HHVM!

1.First this VPS box running Ubuntu 14.04 trusty 64 bit with 2 GB Memory and 2 Core CPU.
Please follow HHVM, Nginx and MariaDB 's offical installation guide to install:





After installation I have these files under /etc/apt/sources.list.d/:
nginx.list
deb http://nginx.org/packages/ubuntu/ trusty nginx


mariadb.list
deb http://mariadb.mirror.iweb.com//repo/10.0/ubuntu trusty main


hhvm.list
deb http://dl.hhvm.com/ubuntu trusty main


At this moment I have the version:

root@mds-magento:/var/www/magento/includes# dpkg -l|grep hhvm
ii hhvm 3.3.0~trusty amd64 HHVM virtual machine, runtime, and JIT for the PHP language
root@mds-magento:/var/www/magento/includes# dpkg -l|grep nginx
ii nginx 1.6.2-1~trusty amd64 high performance web server
root@mds-magento:/etc/apt/sources.list.d# dpkg -l|grep mariadb
ii libmariadbclient18 10.0.14+maria-1~trusty amd64 MariaDB database client library
ii mariadb-client-10.0 10.0.14+maria-1~trusty amd64 MariaDB database client binaries
ii mariadb-client-core-10.0 10.0.14+maria-1~trusty amd64 MariaDB database core client binaries
ii mariadb-common 10.0.14+maria-1~trusty all MariaDB database common files (e.g. /etc/mysql/conf.d/mariadb.cnf)
ii mariadb-server 10.0.14+maria-1~trusty all MariaDB database server (metapackage depending on the latest version)
ii mariadb-server-10.0 10.0.14+maria-1~trusty amd64 MariaDB database server binaries
ii mariadb-server-core-10.0 10.0.14+maria-1~trusty amd64 MariaDB database core server files


2.Share my Nginx config file:
/etc/nginx/nginx.conf


user www-data;
worker_processes 2;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
}


http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
autoindex off;
#tcp_nopush on;

map $scheme $fastcgi_https { ## Detect when HTTPS is used
default off;
https on;
}

keepalive_timeout 10;

gzip on;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript application/xml application/xml+rss text/javascript;

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}


/etc/nginx/hhvm.conf

location ~ .(hh|php)$ {
fastcgi_keep_conn on;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}


/etc/nginx/fastcgi_params


fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param HTTPS $https if_not_empty;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;


/etc/nginx/sites-enabled/magento

server {
listen 80;
server_name localhost;
rewrite / $scheme://www.$host$request_uri permanent; ## Forcibly prepend a www
}

server {
listen 80 default;

#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;

root /var/www/magento;

location / {
index index index.html index.htm index.php;
try_files $uri $uri/ @handler;
}

## These locations would be hidden by .htaccess normally
location ^~ /app/ { deny all; }
location ^~ /includes/ { deny all; }
location ^~ /lib/ { deny all; }
location ^~ /media/downloadable/ { deny all; }
location ^~ /pkginfo/ { deny all; }
location ^~ /report/config.xml { deny all; }
location ^~ /var/ { deny all; }

location /. { ## Disable .htaccess and other hidden files
return 404;
}

location @handler { ## Magento uses a common front handler
rewrite / /index.php;
}

location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
rewrite ^(.*.php)/ $1 last;
}

location ~ .php$ { ## Execute PHP scripts
if (!-e $request_filename) { rewrite / /index.php last; } ## Catch 404s that try_files miss

expires off; ## Do not cache dynamic content
fastcgi_keep_conn on;
fastcgi_pass unix:/var/run/hhvm/hhvm.sock;
fastcgi_index index.php;
fastcgi_param HTTPS $fastcgi_https;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE default; ## Store code is defined in administration > Configuration > Manage Stores
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params; ## See /etc/nginx/fastcgi_params
}
}


3.My HHVM config file:

/etc/hhvm/server.ini

; php options

pid = /var/run/hhvm/pid

; hhvm specific

;hhvm.server.port = 9000
hhvm.server.file_socket = /var/run/hhvm/hhvm.sock
hhvm.server.type = fastcgi
hhvm.server.default_document = index.php
hhvm.log.use_log_file = true
hhvm.log.file = /var/log/hhvm/error.log
hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc


/etc/hhvm/php.ini

; php options

; hhvm specific
hhvm.log.level = Warning
hhvm.log.always_log_unhandled_exceptions = true
hhvm.log.runtime_error_reporting_level = 8191
hhvm.mysql.typed_results = false


Thank you for the kind sharing from:

http://bryanapperson.com/blog/intro-hhvm-mariadb-nginx-wordpress/
http://bryanapperson.com/blog/install-hhvm-nginx-ubuntu-14-04-make-wordpress-fly/
http://wiki.nginx.org/Install#Official_Debian.2FUbuntu_packages
https://udinra.com/blog/hhvm-fastcgi-nginx-speedup-php
http://stackoverflow.com/questions/23872439/nginx-rewrite-with-laravel-and-hhvm

Monday, September 22, 2014

Fix HHVM 3.3 Bad Gateway error Debian Ubuntu

Found HHVM upgrade to 3.3 on Ubuntu Server 14.04 LTS:

Current status: 2 updates [+2], 33 new [+2].

The following packages will be upgraded:
hhvm linux-firmware
2 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 31.7 MB of archives. After unpacking 11.3 kB will be used.
Do you want to continue? [Y/n/?] y
Get: 1 http://ca.archive.ubuntu.com/ubuntu/ trusty-updates/main linux-firmware all 1.127.6 [20.1 MB]
Get: 2 http://dl.hhvm.com/ubuntu/ trusty/main hhvm amd64 3.3.0~trusty [11.6 MB]
Fetched 31.7 MB in 9s (3,221 kB/s)
(Reading database ... 57804 files and directories currently installed.)
Preparing to unpack .../hhvm_3.3.0~trusty_amd64.deb ...
********************************************************************
* HHVM is being removed. You can remove it from your webserver with:
*
* $ sudo /usr/share/hhvm/uninstall_fastcgi.sh
* $ sudo /etc/init.d/nginx restart
* $ sudo /etc/init.d/apache restart
********************************************************************
Unpacking hhvm (3.3.0~trusty) over (3.2.0~trusty) ...
Preparing to unpack .../linux-firmware_1.127.6_all.deb ...
Unpacking linux-firmware (1.127.6) over (1.127.5) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up hhvm (3.3.0~trusty) ...
update-alternatives: using /usr/bin/hhvm to provide /usr/bin/php (php) in auto mode
********************************************************************
* HHVM is installed.
*
* Running PHP web scripts with HHVM is done by having your webserver talk to HHVM
* over FastCGI. Install nginx or Apache, and then:
* $ sudo /usr/share/hhvm/install_fastcgi.sh
* $ sudo /etc/init.d/hhvm restart
* (if using nginx) $ sudo /etc/init.d/nginx restart
* (if using apache) $ sudo /etc/init.d/apache restart
*
* Detailed FastCGI directions are online at:
* https://github.com/facebook/hhvm/wiki/FastCGI
*
* If you're using HHVM to run web scripts, you probably want it to start at boot:
* $ sudo update-rc.d hhvm defaults
*
* Running command-line scripts with HHVM requires no special setup:
* $ hhvm whatever.php
*
* You can use HHVM for /usr/bin/php even if you have php-cli installed:
* $ sudo /usr/bin/update-alternatives --install /usr/bin/php php /usr/bin/hhvm 60
********************************************************************


The web server shows: Bad Gateway.

Try restart HHVM:

# service hhvm restart
* Restarting HHVM FastCGI Daemon hhvm
/usr/bin/hhvm: error while loading shared libraries: libgmp.so.10: cannot open shared object file: No such file or directory


Install libgmp10 package, restart HHVM solve the problem:

# aptitude install libgmp10
The following NEW packages will be installed:
libgmp10
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.

# service hhvm restart
* Restarting HHVM FastCGI Daemon hhvm