________________________________________ From: Waynn Lue [waynnlue@xxxxxxxxx] Sent: Saturday, September 27, 2008 6:04 AM To: Per Jessen Cc: php-general@xxxxxxxxxxxxx Subject: Re: PHP + Cron jobs > > > 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? cron does NOT NOT NOT run with the same user/shell as "you" from command line. You have TWO different versions of PHP running on your system. You are running one of them (the newer one). cron is running the older one, almost for sure. Do this from command line: which php Now do this: * * * * * which php Be ready to comment that cron job out as soon as you get the email (and several more) It runs every minute. :-) But you'll find that cron ain't running the same "which php" as you are. TIP: cron jobs should ALWAYS have the FULL path to all files, binaries, inputs, and everything else if you expect it to do what you think it is doing. _______________________________________________________ The information in this email or in any file attached hereto is intended only for the personal and confiden- tial use of the individual or entity to which it is addressed and may contain information that is propri- etary and confidential. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communica- tion is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product. Email trans- mission cannot be guaranteed to be secure or error- free. P6070214 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php