Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何判断 PHP 是否在 FCGI 模式下运行?
phpinfo,即使在 suPHP 模式下运行也sapi_name()总是返回。CGI/FCGI
phpinfo
sapi_name()
CGI/FCGI
是否可以生成一个失败/仅适用于 FCGI 的 php 代码?
我知道当脚本由 root 拥有时,可能会强制 suPHP 失败,我正在寻找同样的技巧。
编辑:只有当我认为启用了 fcgi 时,才在环境中找到“PHP_FCGI_CHILDREN”,也许是这样?
suPHP 在 CGI 模式下将 PHP 作为一个单独的进程运行,这就是为什么您会看到CGI/FCGI.
当您在 FastCGI 模式下运行 PHP 时,您可以设置特定的环境变量,例如(您提到的)PHP_FCGI_CHILDREN。这可能是一种方法,但您也可以修改 FastCGI 包装脚本以定义您自己的自定义环境变量并对其进行测试。
PHP_FCGI_CHILDREN