Re: PHP + Cron jobs
| From: | Waynn Lue | Date: | Sat, 27 Sep 2008 11:04:14 +0000 |
| Subject: | Re: PHP + Cron jobs | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-281028@lists.php.net to get a copy of this message | ||
>
> > This is something that I've noticed for awhile, but last post to this
> > mailing list reminded me that someone probably already knows how to
> > work
> > around this! I have a cron job that looks something like
> >
> > 12 6 * * * php /home/foo/temp.php
> >
> > But even if temp.php doesn't output anything, I still get emails from
> > the crontab that consist of
> >
> > "Content-type: text/html"
> >
> > I assume this is happening because it's interpreting as a web page or
> > some such.
>
> Somehow your /home/foo/temp.php isn't running with the correct PHP
> interpreter.
>
> > Is there a better way to set the crontab so I don't get that
> > output?
>
> You can always use MAILTO= to direct any output from a cronjob.
>
I actually am using MAILTO, and that's where the problem is. A cronjob only
mails when there actually is output, which I'm fine with. In fact, when I
run php temp.php from the command line, I don't get any output. But when
it's part of the cronjob, there's that content-type output, which triggers
mail to me.
You mentioned a correct php interpreter above. Should I instead be running
php through some other way or with a specific flag?
Waynn