Hello everyone, I'm new to this forum, I have the next problem I hope someone can advise.
I have a php script I need to run from cronjobs.
This script contains some commands shell_exec, fairly simple and the output is directed to a file, from the webmin module cronjobs goes well
but when running from cron, the commands shell_exec stops working
the cronjob is
* * * * * php /some/path/myscript.php
to make it easy
#!/usr/bin/php -q
<?php
$iptables=shell_exec('iptables -S ');
$file_name="/some/path/out_test.txt";
$ar=fopen("$file_name","w");
fputs($ar,$iptables);
fputs($ar,"nn");
fclose($ar);
?>
from the terminal when I run $ php /some/path/myscript.php as root, the file /some/path/out_test.txt is filled with the output of the command $ iptables-S
but when run from cron, the file is blank