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);
Add path: replace ip
by /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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With