dongpinken0498 2019-09-13 12:48
浏览 381

从PHP的shell_exec()函数执行Golang二进制文件

I have compiled a golang binary that takes 1 argument, generates a PDF file, and then uploads it to AWS S3. The binary works perfectly in the shell, however when trying to execute it using PHP's shell_exec(), exec(), passthru() and service() functions, it will not execute (no error messages or log entries). I have even tried calling a shell script (.sh) from PHP's shell_exec which executes the binary (also works fine in the shell), but to no avail.

Permissions are fine and PHP's shell_exec() works for all other instances.

  • 写回答

2条回答 默认 最新

  • doujionggan9570 2019-09-13 16:39
    关注

    shell_exec function Maybe require password of sudo ,

    Linux pipe for sudo password

    shell_exec('echo "YOURPASS" | sudo -u root -S your_script.sh');
    
    
    
    评论

报告相同问题?

悬赏问题

  • ¥15 如何实验stm32主通道和互补通道独立输出
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题