Chapter 2: Installation & Setup

Download HolyPHP

There are several ways to get HolyPHP:

Option 1: Download Installer (Easiest)

From the official website:

Option 2: Build from Source

If you want to build it yourself, you'll need a C11 compiler (gcc/clang/MSVC) and GNU ld.

git clone https://github.com/Elifoxcoder/holyphp
cd holyphp
bash scripts/build.sh
./hphp.exe version       # Windows / MinGW
./hphp version           # Linux

On Windows the setup installs the compiler for your user and can add it to your user PATH. Open a new terminal after setup. On Debian or Ubuntu, install the downloaded package with sudo apt install ./holyphp_<version>_amd64.deb.

Verify Installation

After installation, open a terminal/command prompt and check:

hphp version

For the 1.0.2 release, the version command reports:

HolyPHP 1.0.2

Understanding the hphp Command

The hphp command is your main tool. Here are the most common commands:

CommandDescription
hphp run file.hphpCompile and run a program immediately
hphp build file.hphp -o appBuild a standalone executable
hphp check file.hphpCheck types and borrows without running
hphp emit file.hphpShow internal representation
hphp pkgPackage manager
hphp versionShow version info

Build requirements

The compiler is separate from the C compiler used as a backend. To compile or run a source file, install GCC or another supported C compiler and linker, then confirm gcc is available in your terminal PATH. The compiler itself can print its version without GCC.

Environment Variables (Optional)

VariableEffect
HPHP_VERBOSE=1Show backend commands during compilation
HPHP_KEEP_BIN=1Keep the temporary executable when using hphp run

Code Editors

HolyPHP has a VS Code extension for syntax highlighting and live diagnostics:

code --install-extension extension/hphp/holyphp-0.1.0.vsix

It provides syntax highlighting, completions for all 305 builtins, hover signatures, and live hphp check diagnostics.

Tip: You can also use any text editor you like! Just save files with the .hphp extension.
Try it yourselfCheck your setup. Open a new terminal and run hphp version. Then check whether a C compiler is available with gcc --version. Write down which command works and what version it reports.
Show a hint

Take one small step at a time. Follow the instructions above, write down the result you expect, and compare it with what your terminal or Playground shows. If a command fails, check the filename and that you opened a new terminal after installation.