Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

You can run PHP with the -q command line switch. The manual only say:

Quiet-mode. Suppress HTTP header output (CGI only).

What does that actually mean in practical terms?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
503 views
Welcome To Ask or Share your Answers For Others

1 Answer

This only concerns the PHP interpreter built against the CGI SAPI. This version sends a few basic HTTP headers before any actual output:

X-Powered-By: PHP/5.3.3-1ubuntu9.3
Content-type: text/html

"(echo) What I actually wanted to have"

So basically the -q commandline flag prevents any header() from being written to stdout.

The purpose is to use the php-cgi binary in lieu of the php CLI variant for console scripts. Usually you see following shebang in such scripts to force php-cgi to behave like the -cli version:

#!/usr/bin/php-cgi -qC

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...