douhunbei0166 2017-05-17 11:00
浏览 37

如何通过PHP触发Shell脚本

Based on certain form entries from a PHP front end user form, I need to persist the data in a file (already achieved) and after which execute a shell script as an action. I am able to write to a file from PHP however I am not able to trigger another file of the same directory with exactly same permissions for both. I have tried both exec and shell_exec, but doesn't seems to help ! Some of the sample tried includes -

shell_exec("/bin/sh  dq_files/shell_script.sh");
shell_exec("./dq_files/shell_script.sh");
shell_exec("sh dq_files/shell_script.sh");
exec("<similar-shell-functions-as-above>, $result, $output);

All of which didn't help.

Note - My php.ini file's disable_functions is empty (disable_functions=) and my PHP's Safe mode is Off. The PHP is being executed by apache user and apache group, I have updated all files in that directory and till the lowest hierarchy with 777 permissions and ownership has been transferred to apache:apache, but didn't seem to benefit.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 程序不包含适用于入口点的静态Main方法
    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记