douyong1905 2013-10-07 13:31
浏览 85

调用php exec()时未加载共享库

I am triggering an executable using php

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

PHP exec() or for that matter system() or shell_exec() works fine because status.txt gets written to, but cat status.txt says error while loading shared libraries: libQtCore.so.4: cannot open shared object file: No such file or directory. This means the binary doesn't get executed

I tried changing my php code to the following without any luck

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

The binary is readable by user apache and so are the libraries.

  • 写回答

1条回答 默认 最新

  • dougao2830 2013-12-06 15:38
    关注

    Try running the command as sudo.

    for example

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

报告相同问题?

悬赏问题

  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 luckysheet
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型
  • ¥50 buildozer打包kivy app失败
  • ¥30 在vs2022里运行python代码
  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱