3

PHPを使用して実行可能ファイルをトリガーしています

$commstr = '/abs/path/to/binary > status.txt &';
echo "Running command: ".$commstr."\n";
shell_exec($commstr);

PHPexec()またはそれについてはsystem()shell_exec()status.txt が書き込まれるため正常に動作しますがcat status.txterror while loading shared libraries: libQtCore.so.4: cannot open shared object file: No such file or directory. これは、バイナリが実行されないことを意味します

私は自分のphpコードを次のように変更しようとしましたが、うまくいきませんでした

$commstr = 'export LD_LIBRARY_PATH=/path/to/lib ; /abs/path/to/binary > status.txt &';

バイナリはユーザーが読み取り可能でapacheあり、ライブラリも読み取り可能です。

4

1 に答える 1

0

コマンドを sudo として実行してみてください。

例えば

$commstr = 'sudo export LD_LIBRARY_PATH=/path/to/lib ; /abs/path/to/binary > status.txt &';
于 2013-12-06T15:38:32.413 に答える