Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?


In order to get rid of the header, see:

share|improve this question
up vote 1 down vote accepted

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.

share|improve this answer
No call to header, but what do you mean by white spaces? There are some white spaces between my PHP instructions, but I don't echo or print any... – JVerstry May 23 '12 at 15:28
If you have something like this: <?php dosomestuff(); ?> <?php dosomethingelse(); ?> the spaces between ?> and <?php will be sent as output. – xofer May 23 '12 at 15:31
No, I don't. I only have one <?php ... ?>. I think I need to find how to remove that header... – JVerstry May 23 '12 at 15:32
Try removing the ?> at the end of the file. – xofer May 23 '12 at 15:33
Just did, but it does not solve the issue – JVerstry May 23 '12 at 15:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.