Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to install PHP 7.2 and V8Js on Ubuntu
apt update
apt upgrade
apt-get install python-software-properties
add-apt-repository -y ppa:ondrej/php 
add-apt-repository -y ppa:pinepain/libv8-archived
apt update
apt-get install php7.2 php7.2-curl php7.2-dev php7.2-mbstring php7.2-zip php7.2-mysql libv8-dev
pecl install v8js
echo 'extension=v8js.so' >> /etc/php/7.2/cli/conf.d/20-v8js.ini 
php -i | grep v8js

// confirmed with Ubuntu 16 and 17
@gbkhero
Copy link

gbkhero commented Sep 19, 2018

it works! thank u so much!

@gopal-g
Copy link

gopal-g commented Oct 8, 2018

Hi, I followed this instructions but encountered the following error. Could u please let me know what might be the cause of this .

screen shot 2018-10-08 at 4 17 41 pm

@dmedeletncsa
Copy link

dmedeletncsa commented Nov 8, 2018

try
sudo bash -c 'echo ''extension=v8js.so'' >> /etc/php/7.2/cli/conf.d/20-v8js.ini'

not sure the syntax is correct

@xxxalz
Copy link

xxxalz commented Nov 20, 2018

The repository 'http://ppa.launchpad.net/pinepain/libv8-archived/ubuntu bionic Release' does not have a Release file

@hamzaali00001
Copy link

hamzaali00001 commented Jan 8, 2019

When I run apt-get install python-software-properties I get the following error

Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python-software-properties is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  software-properties-common

E: Package 'python-software-properties' has no installation candidate

@koriym
Copy link
Author

koriym commented Jan 13, 2019

Installation confirmed again on Ubuntu 16.

@MicroDreamIT
Copy link

MicroDreamIT commented Jun 23, 2019

@dmedeletncsa

this kind of warning I am having after trying two times executing your code

PHP Warning:  PHP Startup: Unable to load dynamic library 'v8js.so' (tried: /usr/lib/php/20170718/v8js.so (/usr/lib/php/20170718/v8js.so: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/v8js.so.so (/usr/lib/php/20170718/v8js.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'v8js.so' (tried: /usr/lib/php/20170718/v8js.so (/usr/lib/php/20170718/v8js.so: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/v8js.so.so (/usr/lib/php/20170718/v8js.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.2.19-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: May 31 2019 11:16:55) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.19-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

@joehoyle
Copy link

joehoyle commented Jul 24, 2019

It looks like pinepain/libv8-archived no longer includes libv8-dev

@MicroDreamIT
Copy link

MicroDreamIT commented Jul 25, 2019

@joehoyle its complex to configure and v8js. I tried many many times but did not happen yet.

@p0ise
Copy link

p0ise commented Aug 17, 2019

The repository 'http://ppa.launchpad.net/pinepain/libv8-archived/ubuntu bionic Release' does nothave a Release file.

@gkweb
Copy link

gkweb commented Jun 26, 2020

Worth pointing out that libv8-dev is outdated now. You will need to compile a newer version of v8 in your system. See this: https://github.com/phpv8/v8js/blob/php7/README.Linux.md

Hope this helps someone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment