Hi all.
I'm trying to use CGI version of PHP 4.0.4pl1 as a scripting language, to be called with cron. I'm running this on Redhat 7.0, but have also had the same problem with Redhat 6.2. I've been configuring the cron jobs with Webmin.
I have tried the following as both a normal user and root, and have the same problems.
First, I create a simple script:
#!/usr/local/bin/php -q
<?php
echo "OK!";
exec("touch /home/mike/test.txt");
?>
I give this file execute permissions and I can run it from my bash account...the text is displayed and the dummy file creatd. But when I set it to run as a cron job, it will not produce any output, nor will it create the dummy file.
I have read that cron doesn't use the same PATH and other environment variables as a user account, but why would that matter in this case? The path to PHP is given fully, and the script code is right there.
I've also tried a bash script wrapper that calls the PHP script...once again, it works as a user but not as cron.
Any suggestions? It's driving me nuts. Thanks for your help.