Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

murilo's avatar
Level 10

Extension V8 PHP on ubuntu how install

Hello , I have seen this tutorial -

https://www.youtube.com/watch?v=cTwQtmFjYkw

How to use Server Side Rendering with VUE + Laravel .

In this tutorial , he install in his machine ( MAC) , a php Extension , the name is V8 ;

He dont show how to install this on the server , I need install this extension on ubuntu , to make it works .

After he install , this V8 extension , he type the command -

v8

and it shows that the v8 extension was installed .

Well , I tried many things . to install this extension in my ubuntu server , it says that install , but when I type the command v8 it shows the message -

v8: command not found


I saw in this page how to install on ubuntu -

https://php-v8.readthedocs.io/en/latest/getting-started/

I tried -

$ sudo add-apt-repository -y ppa:ondrej/php
$ sudo add-apt-repository -y ppa:pinepain/php
$ sudo apt-get update -y
$ sudo apt-get install -y php7.2 php-v8
$ php --ri v8

I tried as well -

sudo apt update
sudo apt install libv8-dev

but I was no success ,

I tried like that as well -

http://michaellaszlo.com/installing-d8-javascript-shell-linux/

please , some help me . I need make server side rendering works in a VUE + Laravel Project .

Thanks

0 likes
3 replies
murilo's avatar
Level 10

hello @gitwithravish , It didnt work . maybe becose it is php 7.4 .

I did like that -

apt-get install php-pear php5-dev libv8-dev g++ cpp
pecl install v8js-0.1.3

OPEN PHP INI - 
sudo nano /etc/php/7.4/fpm/php.ini

and added the line -
extension=v8js.so

restart services 
sudo service nginx restart && service php7.4-fpm restart


Now test -
V8
v8: command not found
or 

$v8 = new V8Js();

-bash: syntax error near unexpected token `('


murilo's avatar
Level 10

I did this step -

https://github.com/phpv8/php-v8

$ sudo add-apt-repository -y ppa:ondrej/php
$ sudo add-apt-repository -y ppa:pinepain/php
$ sudo apt-get update -y
$ sudo apt-get install -y php7.4 php-v8

then -

$ php --ri v8
show this error
Extension 'v8' not present.


Please or to participate in this conversation.