在安静模式下运行PHP是什么意思? [英] What does it mean to run PHP in quiet mode?
问题描述
您可以使用-q
命令行开关运行PHP.手册只说:
You can run PHP with the -q
command line switch. The manual only say:
安静模式.禁止HTTP标头 输出(仅CGI).
Quiet-mode. Suppress HTTP header output (CGI only).
实际上,这实际上意味着什么?
What does that actually mean in practical terms?
推荐答案
这仅涉及针对CGI SAPI构建的PHP解释器.此版本在实际输出之前会发送一些基本的HTTP标头:
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"
因此,基本上-q
命令行标志可防止将任何header()
写入标准输出.
So basically the -q
commandline flag prevents any header()
from being written to stdout.
目的是使用php-cgi二进制文件代替控制台脚本的php CLI变体.通常,您会在此类脚本中看到以下shebang来强制php-cgi表现为-cli版本:
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
这篇关于在安静模式下运行PHP是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!