Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP CRON job, not output HTTP headers

Tags:

php

cron

I have a PHP script that is called via a cron job, with the results sent to my email address:

"php /path/to/cron.php"

I only echo errors, otherwise nothing is outputted by me. This way I can get an error report when things go wrong. The problem is, I receive an email with ever cron execution, that only has the HTTP headers in it:

X-Powered-By: PHP/5.2.10
Content-type: text/html

This is obviously a pain, receiving multiple emails every few minutes. All I'd like to see are emails for cron jobs where I've echo'd something.

I want to keep the email being generated by the cron job if possible (instead of sending the email in-script). And I don't want to run it via wget, because my host counts that against my bandwidth.

All my searching has only shown me how to set headers, not remove/suppress the default ones. Am I going about this wrong? Has anybody else seen this?

Thanks

like image 986
ZestySetudios Avatar asked Oct 20 '09 04:10

ZestySetudios


1 Answers

Try this

php -q /path/to/cron.php

From here: http://www.php.net/manual/en/features.commandline.php#24970

like image 182
Joel Avatar answered Nov 15 '22 21:11

Joel