5

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

4

2 回答 2

6

在执行之前调用 putenv:

putenv('PATH=/usr/ant/bin');
于 2015-07-30T16:29:33.443 回答
0

环境变量是在用户会话的上下文中设置的。如果你想为 PHP 用户设置变量,你应该检查运行 apache 的用户(通常是 apache),并添加

export PATH=/usr/ant/bin

/home/apache/.bashrc

apache以便为用户启动的每个会话设置路径。

于 2012-05-31T14:51:40.547 回答