Skip to content
Advertisement

PHP popen Application cannot open shared object

I’ve created a simple C++ Application with the boost framework. The Application is running correct from the command line.

After this I’ve created a PHP file with a popen to this binary.

<?php
  $handle = popen("./webParser", "r");
  //echo $handle . ":: " . gettype($handle);
  $read = fread($handle, 2096);
  echo $read;
  pclose($handle);
  //echo "done";
?>

After visiting the website I’ve got the following error message from apache2/error_log

./webParser: error while loading shared libraries: libboost_log.so.1.59.0: cannot open shared object file: No such file or directory

System is openSuse Linux.

Steps done:

  • Insert lib path to /etc/ld.so.conf and running ldconfig

Advertisement

Answer

You need to make sure you have LD_LIBRARY_PATH set for user running your web server includes the location of the shared library you’ve built.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement