This is a simple tutorial to help you install v8js for PHP on Windows.
If you want to install v8js for PHP on Linux, you can follow this tutorial:
Let’s get started.
First check if your PHP has Thread Safety, as we’ll need to know that to download the correct module. You can run a simple command in Windows to check this. It might be possible that you have to navigate to the PHP folder, but you can also find this by using a php_info(); file.
php -i | findstr "Thread"
This will output something like:
Thread Safety => enabled
Now download the appropriate v8js module, depending on your PHP version, if you are unsure, you can run
php -v to find out your PHP version.
- v8js – PHP 7 – thread safe (x86) latest
- v8js – PHP 7 – non thread safe (x86) latest
- v8js – PHP 5.5 – thread safe (x86) v0.1.3
- v8js – PHP 5.5 – non thread safe (x86) v0.1.3
If you need another version you can check out:
- PHP 7 – https://github.com/phpv8/v8js
- PHP 5.x – https://github.com/phpv8/v8js/tree/master
- PHP 5.x binaries – http://windows.php.net/downloads/pecl/snaps/v8js/0.1.3/
An easy way to download x64 binaries is to download one of the full PHP builds by Jan-E here:
You can then simply copy over the files you need.
Now that you have all the files you need, extract them in their respective folders:
These files go in your
- icui18n.dll (php7)
- icuuc.dll (php7)
And this file goes in your
Now the last thing you have to do is add the following to the end of your
Now restart your webserver and you’re all done!
Let’s test it out with a simple script:
$v8 = new V8Js(); $v8->executeString("print('hello world');");