Ubuntu_16.04 [SOLVED]: PhantomJS unable to find GLIBC when executed from PhP

Ubuntu_16.04 [SOLVED]: PhantomJS unable to find GLIBC when executed from PhP

Home Forums Ubuntu 16.04 Ubuntu_16.04 [SOLVED]: PhantomJS unable to find GLIBC when executed from PhP

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #36420

    Anonymous

    QuestionQuestion

    I am running Ubuntu 16.04 LTS Desktop and the lampp stack (apache2, php7.0, mysql). I am attempting to execute phantomjs -v from PhP and it says that it can not find `GLIBCXX_3.4.9′, yet when I execute via console it runs and outputs the version (2.1.1) just fine.

    The factors I have ruled out:

    Permissions
    

    Info:

    PHP: Version 7.1.10
    OS: 16.04.1-Ubuntu
    

    Error:

    /phantomjs-2.1.1-linux-x86_64/bin/phantomjs: /opt/lampp/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by phantomjs-2.1.1-linux-x86_64/bin/phantomjs)
    

    PhP Exec:

    $cmd = "/phantomjs-2.1.1-linux-x86_64/bin/phantomjs -v";
    $my_output = shell_exec($cmd.' 2>&1; echo $?');
    echo $my_output."<br><br>".get_current_user()."<br><br>".$cmd;
    

    Edit: This is not a libstdc++ error. As I’ve said I can run it in console fine, it is only when I try to run it in PhP that I have an error.

    libstdc++6 is already the newest version (5.4.0-6ubuntu1~16.04.5).
    
    contempt@contempt-MacBookPro:/opt/lampp/lib$ strings libstdc++.so.6 | grep GLIB
        GLIBCXX_3.4
        GLIBCXX_3.4.1
        GLIBCXX_3.4.2
        GLIBCXX_3.4.3
        GLIBCXX_3.4.4
        GLIBCXX_3.4.5
        GLIBCXX_3.4.6
        GLIBCXX_3.4.7
        GLIBCXX_3.4.8
        GLIBC_2.3
        GLIBC_2.4
        GLIBC_2.2.5
    

    #36421

    Anonymous

    Accepted AnswerAnswer

    Obviously I posted my question with a minute or two less research than I should of had. The shell_exec command is trying to use the /lib/ from /opt/lampp/ meanwhile console in Ubuntu uses it from /usr/lib/ Removing the libstdc++ from /opt/lampp and copying it from my user files fixed my issue.

    contempt@contempt-MacBookPro:/opt/lampp/lib$ cp -a /usr/lib/x86_64-linux-gnu/libstdc++.so.6 .
    

    Source: https://stackoverflow.com/questions/47851884/phantomjs-unable-to-find-glibc-when-executed-from-php
    Author: Exsanity
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.