v8js

From DreamFactory
Jump to: navigation, search
Line 1: Line 1:
 
This module allows you to execute server-side JavaScript, using the V8 engine.
 
This module allows you to execute server-side JavaScript, using the V8 engine.
 
These instructions area adapted from https://github.com/phpv8/v8js/blob/master/README.Linux.md
 
  
 
# Install Dependencies
 
# Install Dependencies
#* <source lang="bash">$ sudo apt-get install build-essential git python libglib2.0-dev</source>
+
#* <source lang="bash">$ sudo apt-get install build-essential git php7.1-dev php-pear</source>
# Install Depot Tools
+
# Copy the V8 library
#* <source lang="bash">$ cd /tmp</source>
+
#* <source lang="bash">$ git clone https://github.com/dreamfactorysoftware/v8-compiled.git</source>
#* <source lang="bash">$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git</source>
+
#* <source lang="bash">$ sudo mkdir /opt/v8</source>
#* <source lang="bash">$ export PATH=`pwd`/depot_tools:"$PATH"</source>
+
#* <source lang="bash">$ sudo cp -R v8-compiled/ubuntu_16.04/PHP7.1/* /opt/v8/</source>
# Download V8
+
#* <source lang="bash">$ fetch v8</source>
+
# Setup GN
+
#* <source lang="bash">$ cd v8</source>
+
#* <source lang="bash">$ tools/dev/v8gen.py -vv x64.release</source>
+
#* <source lang="bash">$ echo is_component_build = true >> out.gn/x64.release/args.gn</source>
+
# Build v8
+
#* <source lang="bash">$ ninja -C out.gn/x64.release/</source>
+
# Install to /opt/v8
+
#* <source lang="bash">$ sudo mkdir -p /opt/v8/{lib,include}</source>
+
#* <source lang="bash">$ sudo cp out.gn/x64.release/lib*.so out.gn/x64.release/*_blob.bin /opt/v8/lib/</source>
+
#* <source lang="bash">$ sudo cp -R include/* /opt/v8/include/</source>
+
 
# Build and Install v8js from source
 
# Build and Install v8js from source
#* <source lang="bash">$ cd /tmp</source>
 
 
#* <source lang="bash">$ git clone https://github.com/phpv8/v8js.git</source>
 
#* <source lang="bash">$ git clone https://github.com/phpv8/v8js.git</source>
 
#* <source lang="bash">$ cd v8js</source>
 
#* <source lang="bash">$ cd v8js</source>
Line 28: Line 13:
 
#* <source lang="bash">$ ./configure --with-v8js=/opt/v8</source>
 
#* <source lang="bash">$ ./configure --with-v8js=/opt/v8</source>
 
#* <source lang="bash">$ make</source>
 
#* <source lang="bash">$ make</source>
#* <source lang="bash">$ make test</source>
 
 
#* <source lang="bash">$ sudo make install</source>
 
#* <source lang="bash">$ sudo make install</source>
#* <source lang="bash">$ sudo sh -c 'echo "extension=v8js.so" > /etc/php/7.0/mods-available/v8js.ini'</source>
+
#* <source lang="bash">$ sudo sh -c 'echo "extension=v8js.so" > /etc/php/7.1/mods-available/v8js.ini'</source>
 
#* <source lang="bash">$ sudo phpenmod v8js</source>
 
#* <source lang="bash">$ sudo phpenmod v8js</source>
 +
# Restart Apache or Nginx and PHP-FPM

Revision as of 21:44, 13 September 2017

This module allows you to execute server-side JavaScript, using the V8 engine.

  1. Install Dependencies
    • $ sudo apt-get install build-essential git php7.1-dev php-pear
  2. Copy the V8 library
    • $ git clone https://github.com/dreamfactorysoftware/v8-compiled.git
    • $ sudo mkdir /opt/v8
    • $ sudo cp -R v8-compiled/ubuntu_16.04/PHP7.1/* /opt/v8/
  3. Build and Install v8js from source
    • $ git clone https://github.com/phpv8/v8js.git
    • $ cd v8js
    • $ phpize
    • $ ./configure --with-v8js=/opt/v8
    • $ make
    • $ sudo make install
    • $ sudo sh -c 'echo "extension=v8js.so" > /etc/php/7.1/mods-available/v8js.ini'
    • $ sudo phpenmod v8js
  4. Restart Apache or Nginx and PHP-FPM