How to get rid of 'Content-type: text/html' in PHP script output?

php

Solution

Use the `-q` switch on the php command:

php -q whatever.php

This stands for "quiet", and will prevent php from outputting web headers that it normally would.

Alternatively, if you want to be explicit and more verbose, you can use `--no-header`:

php --no-header whatever.php

Source: PHP Manual: Command line options

Problem

I am running a PHP script as a cron job. An email is fired iff the script generates an output. Unfortunately, even if it does not output anything, an email is fired with: ``` Content-type: text/html ``` How can I get rid of this automatic `Content-type: text/html` generation triggering an email?

Original source