I´m using Ubuntu.
I have a PHP script that needs to call a program
in shell and get its output.
That program
uses a shared library, so I need to set up the $LD_LIBRARY_PATH
environment variable. As that program is used system wide, that setup is done on /etc/environment
as follows:
/etc/environment file:
LD_LIBRARY_PATH=/path/to/my/shared/library/libmyshared.so
If I open a terminal and to look for the code, it is there:
$ env | grep LD_LIBRARY_PATH
LD_LIBRARY_PATH=/path/to/my/shared/library/libmyshared.so
Here is the PHP script that needs to call a program:
$cmd = "program";
exec ($cmd, $out);
var_dump($out);
I´m getting a empty dump and an error on PHP saying that the shared library was not found...
error while loading shared libraries: libmyshared.so: cannot open shared object file: No such file or directory
Well, if I issue in PHP:
$cmd = "env;";
exec ($cmd, $out);
var_dump($out);
The output show only a small number of apache variables, none that is being used in a normal terminal window.
What may be missing here so that my exec
command works ?
Help appreciated...