Installing V8 JavaScript Engine and V8js PECL extension on Ubuntu 14

This is much more like a note to self than an instructional guide. If you need to install the latest version V8 JavaScript Engine and V8JS lib for php, you’ll need to compile them from source. (If you’re using Ubuntu 14, the APT repositories have a very old version of those libraries. If those versions are ok for you, just use apt-get to install libv8 and pecl to install the v8js lib for PHP.)

First download, compile and “install” V8 from Google


svn checkout http://v8.googlecode.com/svn/trunk/ ./v8
 cd v8
 make builddeps
 make native library=shared

sudo mkdir -p /usr/lib /usr/include
 sudo cp out/native/lib.target/lib*.so /usr/lib/
 sudo cp -R include/* /usr/include
sudo cp out/native/lib.target/lib*.so /usr/lib/x86_64-linux-gnu/
 echo -e "create /usr/lib/libv8_libplatform.a\naddlib out/native/obj.target/tools/gyp/libv8_libplatform.a\nsave\nend" | sudo ar -M

Then install v8js via pecl


sudo pecl install v8js-0.4.0 # The latest stable version for PHP 5+ at the time of this writing

Now add extension=v8js.so to your php.ini.

Deixe uma resposta

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *