Skip to content

This LIB is very hard to install ! #522

Closed

Description

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?

Activity

  1. jcastilloa commented on Sep 15, 2023

    @jcastilloa

    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-dev

    After installation it is necessary to copy the files with the structure needed by v8js for compilation:

    mkdir /opt/v8
    mkdir /opt/v8/lib
    mkdir /opt/v8/includes

    copy v8 files from /usr/lib/x86_64-linux-gnu/, to /opt/v8js/lib.

    ls /opt/v8/lib
    libnode.so libnode.so.108 libv8.so libv8_libbase.so libv8_libplatform.so libv8_libsampler.so

    copy v8 includes from /usr/include/v8 to /opt/v8/include

    cp -r /usr/include/v8/* /opt/v8/include/

    Installing v8js

    cd /opt/
    git clone https://github.com/phpv8/v8js.git
    cd v8js
    phpize
    ./configure --with-v8js=/opt/v8 LDFLAGS="-lstdc++"
    make
    make test
    make install

    Then add extension=v8js.so to your php.ini file

  2. jcastilloa commented on Sep 26, 2023

    @jcastilloa

    @jcastilloa do you know how to do with CentOS 7?

    @art-fatal, I think so, try installing the packages nodejs-libs and nodejs-devel to provide the v8 library and the includes

  3. kasd commented on Oct 18, 2023

    @kasd

    @art-fatal I managed to install it on CentOS 7 + remi, dm me if you need help.

  4. joehoyle commented on Jan 12, 2024

    @joehoyle

    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

  5. redbullmarky commented on Jan 12, 2024

    @redbullmarky
    Collaborator

    @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

  6. redbullmarky commented on Jan 12, 2024

    @redbullmarky
    Collaborator

    @art-fatal I managed to install it on CentOS 7 + remi, dm me if you need help.

    Perhaps you’d be ok to paste the details here? Then we can probably update the documentation for others :)

  7. Westacular commented on Feb 9, 2024

    @Westacular

    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).

  8. dinamic commented on Apr 5, 2024

    @dinamic

    @Westacular I guess you could open a PR with the changes

  9. dinamic commented on Apr 5, 2024

    @dinamic

    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

  10. redbullmarky commented on May 7, 2026

    @redbullmarky
    Collaborator

    Closed based on #532

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions