You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why is this lib so difficult to install? Why do we have to do dozens of manipulations/builds just to install this extension? Why libv8-dev and pecl install v8js are not enough!
It's crazy, there are almost no resources on the internet to install this library on recent versions of PHP (like 8.1 or 8.2) or on recent operating systems (Ubuntu 22+, CentOS) what a hassle !
After dozens of attempts, I still haven't succeeded, hell you have to have a doctorate in software engineering to install this lib! What hell ?
Can you do something and give clear and complete instructions on how to install this lib on php 8.2 and Ubuntu 22.04 for example?
Reacted by Aldaleon, Julian Krzefski, Danil, spacecreator8 and Boris Zabolotskikh
FWIW this is why I created https://github.com/joehoyle/php-v8js which is a re-implementation of this lib. V8 is included directly on the pre-built php extension so there's no need to mess around with trying to install libv8 on the system
Reacted by Nikola Petkanski, Romain Gautier, Boris Zabolotskikh and Geo Vlasov
@joehoyle i get that you’re trying to help but using issues as a means to divert people away from a project kinda feels a tad awkward and not really in the spirit of open source projects
I was able to get this building on Alpine 3.19 by installing the nodejs-dev package and linking to the libnode.so from that package, which bundles a version of v8 and contains the necessary libv8 symbols. All tests pass.
You can see the changes I made to v8js for this here — I just replaced various references to the various v8 libraries in config.m4 with the monolith node library.
It would be nice to make this something that could be merged back — i.e., update the autoconf logic such that it autodetects and links with either libv8 or libnode, depending on which is present — but I don't know autoconf well enough to really make that change (and don't have the time needed to learn it).
Activity
jcastilloa commentedon Sep 15, 2023
Hi, you are right, installing of v8js on modern versions of PHP is confusing because the documentation is not up to date.
On the other hand, the latest version available in PECL specifies that it does not support php8:
https://pecl.php.net/package-changelog.php?package=v8js&release=2.1.2
I was able to install v8js on php 8.2.9 after a few minutes examining the config.m4 file and my old v8js installation on php 7.2.
Here is an installation guide for debian bookworm and php 8.2.9.
v8 library installation:
apt install libnode-devAfter installation it is necessary to copy the files with the structure needed by v8js for compilation:
copy v8 files from /usr/lib/x86_64-linux-gnu/, to /opt/v8js/lib.
copy v8 includes from /usr/include/v8 to /opt/v8/include
cp -r /usr/include/v8/* /opt/v8/include/Installing v8js
Then add extension=v8js.so to your php.ini file
jcastilloa commentedon Sep 26, 2023
@art-fatal, I think so, try installing the packages nodejs-libs and nodejs-devel to provide the v8 library and the includes
kasd commentedon Oct 18, 2023
@art-fatal I managed to install it on CentOS 7 + remi, dm me if you need help.
joehoyle commentedon Jan 12, 2024
FWIW this is why I created https://github.com/joehoyle/php-v8js which is a re-implementation of this lib. V8 is included directly on the pre-built php extension so there's no need to mess around with trying to install libv8 on the system
redbullmarky commentedon Jan 12, 2024
@joehoyle i get that you’re trying to help but using issues as a means to divert people away from a project kinda feels a tad awkward and not really in the spirit of open source projects
redbullmarky commentedon Jan 12, 2024
Perhaps you’d be ok to paste the details here? Then we can probably update the documentation for others :)
Westacular commentedon Feb 9, 2024
I was able to get this building on Alpine 3.19 by installing the
nodejs-devpackage and linking to thelibnode.sofrom that package, which bundles a version of v8 and contains the necessary libv8 symbols. All tests pass.You can see the changes I made to v8js for this here — I just replaced various references to the various v8 libraries in
config.m4with the monolith node library.It would be nice to make this something that could be merged back — i.e., update the autoconf logic such that it autodetects and links with either libv8 or libnode, depending on which is present — but I don't know autoconf well enough to really make that change (and don't have the time needed to learn it).
dinamic commentedon Apr 5, 2024
@Westacular I guess you could open a PR with the changes
dinamic commentedon Apr 5, 2024
Here's how my Dockerfile looks like, this example is with php 8.3 and Debian 12.
It uses libnode and symlinks the required folders.
https://gist.github.com/dinamic/60a573e6ffa8749f94931a4d7cfcfcb8
Split include and lib directory variables
redbullmarky commentedon May 7, 2026
Closed based on #532