v8js Installation

From DreamFactory
Jump to: navigation, search

Modules

Bitnami Installs on Windows, Mac, and Linux

The Bitnami packages come with v8js already install and running. No further action is necessary.

Linux -- Debian/Ubuntu

Version 0.1.3

If you wish to install an older version of v8js, you can follow these instructions
Please note that this version of v8js does not support require(). In order to support require() you will need use version 0.3 or higher.

  • Ensure that you have the php-pear and php5-dev packages installed on your system. You will also need to install the v8 dev library and g++ and cpp from the package manager
    • $ sudo apt-get install php-pear php5-dev libv8-dev g++ cpp
  • Use PECL to make the v8js.so file
    • $ sudo pecl install v8js-0.1.3
    • If the the install generates any errors it has failed. You will need to troubleshoot based on the error reported.
  • Create a module file for your v8js installation.
    • $ sudo touch /etc/php5/mods-available/v8js.ini
  • Edit the file you just created in your preferred text editor.
    • There is a single line in the file it looks like this:
    • extension=v8js.so
  • Enable the php extension
    • $ sudo php5enmod v8js
  • Restart your web service service
    • $ sudo service apache2 restart
      or
    • $ sudo service php5-fpm restart && sudo service nginx restart

Version 0.4.1

This is for a newer version of the driver, but requires manually compiling the library.
Instructions are adapted from here

  • Ensure that you have the php-pear and php5-dev packages installed on your system. You will also need to install git, g++, and cpp from the package manager
    • $ sudo apt-get install php-pear php5-dev git g++ cpp
  • Build the v8 library
$ cd /tmp
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
$ export PATH=`pwd`/depot_tools:"$PATH"
$ fetch v8
$ cd v8
$ gclient sync
$ make native library=shared snapshot=off -j8\
$ sudo mkdir -p /usr/lib /usr/include
$ sudo cp out/native/lib.target/lib*.so /usr/lib/
$ sudo cp -R include/* /usr/include
$ echo -e "create /usr/lib/libv8_libplatform.a\naddlib out/native/obj.target/tools/gyp/libv8_libplatform.a\nsave\nend" | sudo ar -M
$ sudo cp out/native/lib.target/lib*.so /usr/lib/x86_64-linux-gnu/
  • Use PECL to make the v8js.so file
    • $ sudo pecl install v8js-0.4.1
    • If the the install generates any errors it has failed. You will need to troubleshoot based on the error reported.
  • Create a module file for your v8js installation.
    • $ sudo touch /etc/php5/mods-available/v8js.ini
  • Edit the file you just created in your preferred text editor.
    • There is a single line in the file it looks like this:
    • extension=v8js.so
  • Enable the php extension
    • $ sudo php5enmod v8js
  • Restart your web service service
    • $ sudo service apache2 restart
      or
    • $ sudo service php5-fpm restart && sudo service nginx restart