Hi,
Tuesday, March 4, 2003, 10:01:25 AM, you wrote:
JMC> Dan,
JMC> I used your example exactly like you have it specified. My cron log
JMC> looks like this:
JMC> Mar 3 15:53:00 prod /usr/sbin/cron[3085]: (root) CMD
JMC> (/usr/local/contab-scripts/wibble.php)
JMC> Mar 3 15:54:00 prod /usr/sbin/cron[3085]: (root) CMD
JMC> (/usr/local/contab-scripts/wibble.php)
JMC> However, it does nothing at all. It doesn't create the
JMC> /tmp/wibble.output file. After testing this, I went in and ran the
JMC> wibble.php script by hand from the command line and it worked just as my
JMC> scripts work when I run them by hand. I ran the cron as root and ran
JMC> the script by hand as root. I really think there is a bug somewhere,
JMC> either in FreeBSD or in PHP. I am not sure what it can be. All I know
JMC> is that other scripts like bash scripts run fine from cron. This
JMC> problem is really weird and I would truly appreciate any more assistance
JMC> in getting it resolved.
JMC> Thanks everyone,
JMC> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>> Ok, by looking at my cron logs it looks like cron is trying to run my
>> PHP CLI script. However, it is not running it. I only have one line
JMC> of
>> code that isn't commented out and the line simply sends me an email
>> using the PHP mail() function.
JMC> One thing to keep in mind when working with crontab is environmental
JMC> variables. As in, Cron has none. You have to set any you want in your
JMC> crontab, or your called scripts. For example, use full paths.
JMC> You shouldnt have to call a shell before calling the php cli. Here is an
JMC> example script for you to test. My php binary is in /usr/local/bin/php,
JMC> my
JMC> script is /usr/local/crontab-scripts/wibble.php and the file I am
JMC> writing
JMC> to is in /tmp/wibble.output
JMC> This is what wibble looks like [chmoded to 755, owned by the user of the
JMC> crontab]:
JMC> #!/usr/local/bin/php -q
JMC> <?php
JMC> if ($fp = fopen("/tmp/wibble.output",a)) {
JMC> fputs($fp, "Script Executed on ".date("YmdHis")."\n");
JMC> fclose($fp);
JMC> } else {
JMC> die("Could not open 'wibble.output' for read / write operations");
JMC> }
?>>
JMC> and the crontab line I have is:
JMC> * * * * /usr/local/contab-scripts/wibble.php
JMC> and you can see the output of it running every minute:
JMC> tail -f /tmp/wibble.output
JMC> Works fine for me ... try it
JMC> --
JMC> Dan Hardiker [EMAIL PROTECTED]
JMC> ADAM Software & Systems Engineer
JMC> First Creative
JMC> --
JMC> PHP General Mailing List (http://www.php.net/)
JMC> To unsubscribe, visit: http://www.php.net/unsub.php
Try removing the -q's and see if root or whatever user cron runs as gets
an email with an error message in it, as cron is actully having a
crack at running the script.
--
regards,
Tom
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php