-
Notifications
You must be signed in to change notification settings - Fork 205
Installing on Debian and php8.0 without compiling v8
Andrianirija Lafatra edited this page Sep 26, 2023
·
1 revision
The installation below was tested on Debian GNU/Linux 12 64-bits machine and the module installed in PHP 8.0.
Let's get started.
# Dependencies sudo apt-get install build-essential curl git python-is-python3 libglib2.0-dev # V8 sudo apt update sudo apt install libnode-dev --fix-missing sudo apt --fix-broken install # PHP sudo apt install -y apt-transport-https lsb-release ca-certificates wget sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list sudo apt install -y php8.0 php8.0-dev php8.0-cli
This will build the latest stable version as of this moment used by Chromium and Chrome (7.5.288.23). You can find the currently latest stable versions here, found in the column v8_version.
/!\ DONT FORGET TO REPLACE THE V8 VERSION NUMBER, IT WON'T WORK IF YOU DON'T DO THAT
# Create directory in /opt/v8 sudo mkdir /opt/v8 sudo mkdir /opt/v8/include sudo mkdir /opt/v8/lib # Copy v8 from /usr/lib/x86_64-linux-gnu/ cp /usr/lib/x86_64-linux-gnu/*v8* cp /usr/lib/x86_64-linux-gnu/*node* # Copy V8 include files need to /opt/v8/include cp -r /usr/include/v8/* /opt/v8/include/
Now that v8 is installed, we can compile the module for PHP version(s). For the system PHP the workflow is as follows:
cd /opt/ git clone https://github.com/phpv8/v8js.git cd v8js phpize ./configure --with-v8js=/opt/v8 LDFLAGS="-lstdc++" sudo make sudo make test sudo make install
After sudo make install
the location of the v8js.so
module will be shown.
Add extension=v8js.so
to your php.ini file. You can check the location of you php.ini file via php --ini
.