我已经设置了要运行ant的PATH,并且它正在腻子上工作,但是在php exec上却返回了sh ant命令,但我没有尝试通过export PATH = / usr / ant / bin来设置PATH。
在exec之前调用putenv:
putenv('PATH=/usr/ant/bin');
Environment variables are set in the context of a user session. If you want to set the variable for the PHP user you should check what user apache runs under (typically apache), and add
export PATH=/usr/ant/bin
to
/home/apache/.bashrc
So that the path is set for every session the user apache
starts.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.