如何为php exec或shell_exec设置$ PATH [英] How to set $PATH for php exec or shell_exec

查看:96
本文介绍了如何为php exec或shell_exec设置$ PATH的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了运行ant的路径,并且它正在腻子上工作,但是在php exec上,它返回的是sh ant命令 我试过了 通过导出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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆