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

I am running a PHP script as a cron job. When the script starts, an email is generated. Unfortunately, even if it doesn’t output anything, the email is launched using:

Content-type: text/html

How can I get rid of this automatic generation Content-type: text/htmlthat starts an email?

+3
source share
1 answer

Use the switch -qin php command:

php -q whatever.php

This means "silent" and will not allow php to display the headers of web pages that would normally be.

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

+7
source

All Articles