2

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)
KoSMoS
  • 534
  • 2
  • 5
  • 19

2 Answers2

5

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.
Employed Russian
  • 199,314
  • 34
  • 295
  • 362
  • Sir.. could you help me.. at :: http://stackoverflow.com/questions/22888096/glibcxx-3-4-9-not-found-ubuntu – Mohammed Sufian Apr 06 '14 at 14:55
  • @Muhammad What more help do you need? Your question is an exact duplicate of this one, and the same solution/answer should fix it. – Employed Russian Apr 06 '14 at 18:47
  • @EmpoyedRussian Sir.. i am new to `ubuntu` and `shell_exec` so i dont know how to remove `/opt/lampp/lib/libstdc++.so.6` and use `/usr/lib/libstdc++.so.6` everywhere and Un-set `LD_LIBRARY_PATH` ... please help sir.. – Mohammed Sufian Apr 07 '14 at 06:04
  • Sir please look at this is this the way to solve this: http://community.bitnami.com/t/libstdc-so-6-issue/20589 – Mohammed Sufian Apr 07 '14 at 13:03
  • sir i have tried this.. but still it is not working: `sudo mv /opt/lampp/lib/libstdc++.so.6 /opt/lampp/lib/libstdc++.so.6.orig ` – Mohammed Sufian Apr 07 '14 at 16:18
0

Try this method https://stackoverflow.com/a/63443384/12099812

1.add below line in your PHP file.

var_dump(shell_exec("whoami"));

you can find the username in your browser after clicking the url related to your PHP file

2.in your terminal

sudo vim /ect/sudoers

#in vim editor, add this line in your sudoers file
"username ALL=(ALL) NOPASSWD:ALL"
#change username to that found in step one 

3.change the exec cmd in your PHP file to

exec("sudo python3 urfilename.py")

The main reason for your problem maybe the root permission, so by changing your sudoers file, the error might be tackled.

Wang Wei
  • 39
  • 3