Php HHVM (aka the HipHop Virtual Machine) on Centos 7

To get my php projects running as fast as possible om trying to use hhvm.
And here is my small guide how to install it on centos 7

I used the docs from


1. First setup you centos linux host


yum localinstall
yum localinstall
yum install cpp gcc-c++ cmake git psmisc {binutils,boost,jemalloc}-devel \
{sqlite,tbb,bzip2,openldap,readline,elfutils-libelf,gmp,lz4,pcre}-devel \
lib{xslt,event,yaml,vpx,png,zip,icu,mcrypt,memcached,cap,dwarf}-devel \
{unixODBC,expat,mariadb}-devel lib{edit,curl,xml2,xslt}-devel \
glog-devel oniguruma-devel inotify-tools-devel ocaml
yum install ImageMagick-last\* --enablerepo=remi

My box is a clean centos 7. If you have ImageMagic install already uninstall it.


2. Ok now we have the server ready lets get and build hhvm


cd /opt
git clone -b master  hhvm  --recursive
cd hhvm

Time to build

cmake \
-DLIBMAGICKWAND_INCLUDE_DIRS="/usr/include/ImageMagick-6" \
make -j$(($(nproc)+1))


./hphp/hhvm/hhvm --version
sudo make install




3. Config setup


First create some folders


mkdir /etc/hhvm
mkdir /var/run/hhvm
mkdir /var/log/hhvm
mkdir /var/tmp/hhvm
mkdir -p /usr/share/hhvm/hdf/
chmod 775 /var/run/hhvm
chmod 777 /var/tmp/hhvm

Now add some config files

vi /etc/hhvm/server.hdf
PidFile = /var/run/hhvm/pid
Server {
 Port = 9000
 SourceRoot = /var/www/
 DefaultDocument = index.php
Log {
 Level = Warning
 AlwaysLogUnhandledExceptions = true
 RuntimeErrorReportingLevel = 8191
 UseLogFile = true
 UseSyslog = false
 File = /var/log/hhvm/error.log
 Access {
 * {
 File = /var/log/hhvm/access.log
 Format = %h %l %u % t \"%r\" %>s %b
Repo {
 Central {
 Path = /var/tmp/hhvm/.hhvm.hhbc
#include "/usr/share/hhvm/hdf/static.mime-types.hdf"
StaticFile {
 FilesMatch {
 * {
 pattern = .*\.(dll|exe)
 headers { 
 * = Content-Disposition: attachment 
 Extensions : StaticMimeTypes
 TypedResults = false

and the file

vi /usr/share/hhvm/hdf/static.mime-types.hdf

I added this file



Adding the service

vi /usr/lib/systemd/system/hhvm.service
Description=HHVM HipHop Virtual Machine (FCGI)

ExecStart=/usr/local/bin/hhvm --config /etc/hhvm/server.hdf --user nobody --mode daemon -vServer.Type=fastcgi -vServer.Port=9000


Enable and start

systemctl enable hhvm
systemctl start hhvm
systemctl status hhvm

Error if not started i had some trying with dirs and permissions test chmod 777 to the dirs and then when it works start tight the perms

tail /var/log/hhvm/error.log