Skip to content

Instantly share code, notes, and snippets.

@windbridges
Created December 30, 2019 23:45
Show Gist options
  • Save windbridges/3d1dff2e4f294f1d3b2bb14e8fcee2a7 to your computer and use it in GitHub Desktop.
Save windbridges/3d1dff2e4f294f1d3b2bb14e8fcee2a7 to your computer and use it in GitHub Desktop.
Install v8js on Ubuntu 18.04 and PHP 7.3
sudo apt-get update
sudo apt-get upgrade -y
# add PPA
sudo add-apt-repository ppa:ondrej/php -y
sudo add-apt-repository ppa:stesie/libv8 -y
sudo apt-get update
# install PHP
sudo apt-get install -y php7.3 php7.3-{fpm,cli,common,apcu,mbstring,pdo,xml,curl,bcmath,mysql,redis,sqlite3,zip,geoip,dev}
# install v8
# library is installed to /opt/libv8-7.5
# it's implrtant to install both libv8-7.5 and libv8-7.5-dev,
# because if you skip libv8-7.5-dev then you'll get error in next step:
# error: could not find libv8_libplatform library
sudo apt-get install libv8-7.5 libv8-7.5-dev
# install v8js
printf "\/opt/libv8-7.5\n" | sudo CFLAGS=-w CPPFLAGS=-w pecl install v8js-2.1.1
# enable php extension
echo "extension = v8js.so" | sudo tee -a /etc/php/7.3/mods-available/v8js.ini
sudo phpenmod v8js
# check extension loaded (should output 'v8js')
php -m | grep v8js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment