I am debugging some code and I have the following line that I think is causing errors in my php log sh: ip: command not found
Any ideas as to why or what packages are missing on the Centos
server?
Code:
exec("ip tunnel show | cut -f1 -d' ' | cut -f1 -d':'", $someVar);
添加路径:将ip
替换为/sbin/ip
。
The 'ip' command resides in sbin directory, which may not be in your PATH env variable. There could be more such commands not having their path part of PATH env variable. You need to set /sbin in your path by following below step.
In your shell script, add following two lines BEFORE your exec() line, followed by your exec line:
exec("PATH=\$PATH:/sbin ip tunnel show | cut -f1 -d' ' | cut -f1 -d':'", $someVar);
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.