How to install V8JS for PHP on Ubuntu

This post shows how you can install V8JS PHP extension, which is created by Google, on Ubuntu.

V8Js is a PHP extension for Google’s V8 Javascript engine.

The extension allows you to execute Javascript code in a secure sandbox from PHP. The executed code can be restricted using a time limit and/or memory limit. This provides the possibility to execute untrusted code with confidence.

How to install?

1. Connect to your server’s command line interface.

2. Run:

sudo apt-get install libv8-dev libv8-dbg g cpp

3. Update system:

sudo apt-get update

4. Run:

sudo pecl install v8js-0.2.0 (or other version i.e.: sudo pecl install v8js-0.1.3)

5. Edit your php.ini and append:

6. Restart your server


If it the extension doesn’t work, try to edit /etc/php5/conf.d/v8js.ini and append and restart server again.

If you need a reliable Dedicated Server or VPS, you should definitely try InterServer Hosting. You can test InterServer for 1 Penny, for the first month, using this coupon code: WSG1PENNY.