This page describes how to install the compiler SubsetPHP.


The program llvm_test myfile.php will type-check and compile “myfile.php”.

How to install on Ubuntu 14.04 LTS:

The installation might take up 1 GB of space (mostly clang/LLVM, php-src).

Install some basics:

apt-get install git make m4 unzip pkg-config autoconf re2c bison libxml2-dev ncurses-dev g++

Clone the git:

git clone

Install OCaml and friends:

apt-get install ocaml clang-3.6 llvm-3.6 llvm-3.6-dev

Install OPAM:

wget -O - | sh -s /usr/local/bin/
opam init
eval `opam config env`

Upgrade OCaml to 4.02.3:

opam switch 4.02.3
eval `opam config env`

Install ocamlfind and other necessary OCaml packages:

opam install ocamlfind ppx_deriving llvm.3.6

Download the PHP source:

cd subsetphp/
rm -r php-src/
git clone

Configure and build PHP (make sure all steps finish completely):

cd php-src/

Run the make script. This will compile the compiler and then compile test.php into a binary “test”.

make comp

Please report any errors during installation as a github issue.

How to install on DragonFly BSD 4.4: