Mathieu Hays

I recently had interest in generating a React-based web app using PHP. To be able to do such an amazing thing you first need to install the PHP extension V8Js. You’ll find below the process I followed to install it on my Mac:

First install the engine:

brew install v8

Install dependency for the PECL Extension:

brew install autoconf

Update Pear:

cd /usr/lib/php
sudo php install-pear-nozlib.phar

Then edit your php.ini by adding the following line next existing include_path if not already there

include_path = ".:/usr/lib/php/pear"

Update/Upgrade Pear / PECL

sudo pear channel-update
sudo pecl channel-update
sudo pear upgrade-all

Grab V8Js PECL Extension from github & install it

cd ~
mkdir tmp && cd tmp
git clone
cd v8js
./configure CXXFLAGS="-Wno-c++11-narrowing"
make test # if this step fails you can try make install anyway, should work.
make install

Then edit your php.ini again to add the following line:

All you need to do now is to restart Apache and it should work !

sudo apachectl restart

I can’t guarantee it’ll work for everyone, especially that it might be time sensitive given the compatibility between versions. Hopefully it’ll help some of you 🙂

Obviously I won’t recommend using this in production as it might not be stable.

Edit: 28/01/16 – Update instructions