php shell command error GLIBCXX_3.4.9 not found

2019-03-02 06:47发布

问题:

Im trying to execute shell command from php to convert files to pdf but i get this error.
Could someone explain me in details how to fix it?
Im not so good in linux(
and also if i execute command straight through terminal everything works.

    /usr/lib/libreoffice/program/oosplash: /opt/lampp/lib/libstdc++.so.6:
    version `GLIBCXX_3.4.9' not found 
    (required by /usr/lib/libreoffice/program/../ure-link/lib/libuno_sal.so.3)

回答1:

version `GLIBCXX_3.4.9' not found

The problem is that in this environment, you are using /opt/lampp/lib/libstdc++.so.6 which is too old, and does not define the `GLIBCXX_3.4.9' version.

if i execute command straight through terminal everything works.

In that case, you are likely using /usr/lib/libstdc++.so.6, which is (apparently) new enough.

Possible solutions:

  1. Remove /opt/lampp/lib/libstdc++.so.6 and use /usr/lib/libstdc++.so.6 everywhere (libstdc++.so.6 is supposed to be backwards-compatible, so in theory there should be no reason to use older version).
  2. Un-set LD_LIBRARY_PATH in PHP before invoking oosplash, so it uses the newer library.