2014-07-28

Installing HHVM on Ubuntu or ArchLinux

As we already know, HHVM is the fastest PHP interpreter/JIT-compiler for 64-bit systems. To install HHVM on Ubuntu, the easiest way is use the PPA using these commands:

# install HHVM repos' public key
wget -O - http://dl.hhvm.com/conf/hhvm.gpg.key | sudo apt-key add -

# add HHVM repos
echo deb http://dl.hhvm.com/ubuntu trusty main | sudo tee /etc/apt/sources.list.d/hhvm.list

# update list of available software
sudo apt-get update

# install hhvm
sudo apt-get install hhvm

Or when using archlinux, use yaourt command (warning: this would compile the hhvm package, that requires about ~1 hour and more than 2GB of RAM, so add a virtual memory if your RAM not big enough)

sudo yaourt --needed --noconfirm -S --force hhvm

As we already know, since PHP 5.4, PHP can be used without installing any webserver (Apache, Nginx, IIS), use this command to run built-in web server on localhost:8083:

hhvm -m server -p 8083
mapping self...
mapping self took 0'00" (18015 us) wall time
loading static content...
loading static content took 0'00" (0 us) wall time
page server started
all servers started

or when using standard PHP:

php -S localhost:8083
PHP 5.5.15 Development Server started at Mon Jul 28 20:48:06 2014
Listening on http://localhost:8083
Document root is /tmp
Press Ctrl-C to quit.