I have a PHP script that execute some shell commands.
Once I manually executed it. It worked very fine.
But after I used crontab to execute, the result from some shell commands are missing.
These are 2 commands.
ip route
iptables -t nat -L | grep 8800
and here is a sample PHP code.
#!/usr/bin/php -q
<?
$route = exec('ip route');
$iptable = exec('iptables -t nat -L | grep 8800');
echo $route;
echo $iptables;
?>
The above code worked well with manually execute but not crontab.
I found that some commands worked well with both. For example
ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'
cat /tmp/example | grep test
Any ideas for this problem, and thank you in advance.