Dan,

I used your example exactly like you have it specified.  My cron log
looks like this:

Mar  3 15:53:00 prod /usr/sbin/cron[3085]: (root) CMD
(/usr/local/contab-scripts/wibble.php)

Mar  3 15:54:00 prod /usr/sbin/cron[3085]: (root) CMD
(/usr/local/contab-scripts/wibble.php)

However, it does nothing at all.  It doesn't create the
/tmp/wibble.output file.  After testing this, I went in and ran the
wibble.php script by hand from the command line and it worked just as my
scripts work when I run them by hand.  I ran the cron as root and ran
the script by hand as root.  I really think there is a bug somewhere,
either in FreeBSD or in PHP.  I am not sure what it can be.  All I know
is that other scripts like bash scripts run fine from cron.  This
problem is really weird and I would truly appreciate any more assistance
in getting it resolved.

Thanks everyone,


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
of
> code that isn't commented out and the line simply sends me an email
> using the PHP mail() function.

One thing to keep in mind when working with crontab is environmental
variables. As in, Cron has none. You have to set any you want in your
crontab, or your called scripts. For example, use full paths.

You shouldnt have to call a shell before calling the php cli. Here is an
example script for you to test. My php binary is in /usr/local/bin/php,
my
script is /usr/local/crontab-scripts/wibble.php and the file I am
writing
to is in /tmp/wibble.output

This is what wibble looks like [chmoded to 755, owned by the user of the
crontab]:

#!/usr/local/bin/php -q
<?php
  if ($fp = fopen("/tmp/wibble.output",a)) {
    fputs($fp, "Script Executed on ".date("YmdHis")."\n");
    fclose($fp);
  } else {
    die("Could not open 'wibble.output' for read / write operations");
  }
?>

and the crontab line I have is:

* * * * /usr/local/contab-scripts/wibble.php

and you can see the output of it running every minute:

tail -f /tmp/wibble.output

Works fine for me ... try it

-- 
Dan Hardiker [EMAIL PROTECTED]
ADAM Software & Systems Engineer
First Creative



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to