如何为 php exec 或 shell_exec 设置 $PATH [英] How to set $PATH for php exec or shell_exec
本文介绍了如何为 php exec 或 shell_exec 设置 $PATH的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已将 PATH 设置为运行 ant 并且它正在处理腻子,但在 php exec 上它返回 sh ant command not found我试过了通过 export PATH=/usr/ant/bin
I have set the PATH to run ant and it is working on putty but on php exec it is returning sh ant command not found i have tried to set PATH by export PATH=/usr/ant/bin
推荐答案
在exec之前调用putenv:
Call putenv before exec:
putenv('PATH=/usr/ant/bin');
这篇关于如何为 php exec 或 shell_exec 设置 $PATH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文