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: extension=v8js.so
  6. Restart your server reboot

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

Last modified: May 8, 2021