2

Is there any documentation about V8JS? Do I need only standard PHP or some extensions to use V8JS?

I'll be very thankful for any information about V8JS in PHP.

1

3 Answers 3

1

Requirements

PHP 5.3.3+ and V8 library and headers installed in proper paths.

Install

Sign up to request clarification or add additional context in comments.

Comments

0

I've found this docs on the v8js class.

Comments

0

The docs out there aren't complete or are not updated. I'm actually currently in the process of doing v8JS myself and it took me a few days to get the back end libs sorted out. First off, you must know that you can't do this is you have python < 2.7

Here is my install notes that I'm putting together for our dev vagrant boxes running centos 7.

cd /tmp # Install depot_tools first (needed for source checkout) git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git export PATH=`pwd`/depot_tools:"$PATH" # Download v8 fetch v8 cd v8 # Build (disable snapshots for V8 > 4.4.9.1) make native library=shared snapshot=off -j8 # Install to /usr sudo mkdir -p /usr/lib /usr/include sudo cp out/native/lib.target/lib*.so /usr/lib64/ sudo cp -R include/* /usr/include echo -e "create /usr/lib64/libv8_libplatform.a\naddlib out/native/obj.target/tools/gyp/libv8_libplatform.a\nsave\nend" | sudo ar -M cd /usr/lib64 sudo chrpath -r '$ORIGIN' libv8.so ======================== Compile php-v8js itself ======================== cd /tmp git clone -b master https://github.com/phpv8/v8js.git cd v8js phpize ./configure make make test sudo make install sudo service httpd restart 

A note on the line make native library=shared snapshot=off -j8. I had the compile stop on me a couple times, I just restarted it. I'm not sure why it stopped, but it restarted just fine and completed just fine.

After that is done, you need to create the php extension file /etc/php.d/v8js.ini with the following content

; Enable v8js extension module extension=v8js.so 

Run the following to make sure it is installed correctly

php -r "phpinfo();" | grep v8js 

If you get output back and no errors you're good to go.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.