Php – considered as output when running a PHP script cron job

cronemailPHP

I am running a PHP script which inserts lines in a database every minute, using a cron job.

My provider says:

An email will be sent to this address ONLY if your cron produces output.
If no output is generated, then no email will be sent.

I am only issuing echo statements in my PHP when there is a query error. But I don't have errors, and I see the lines appearing in my DB.

Yet, I still get emails with (nearly) empty content even if I don't have errors:

Content-type: text/html

How can I prevent this? What is considered as output when running a PHP script cron job?

UPDATE

In order to get rid of the header, see: https://stackoverflow.com/questions/10723546/how-to-get-rid-of-content-type-text-html-in-php-script-output

Best Answer

Do you have any calls to header in the code? Any whitespace outside of <?php ... ?> blocks? To answer your question 'output' is anything that would be sent to the browser in non-CLI operation, like that HTTP header you're seeing.

Related Topic