了解如何PHP是在服务器上(CGI或快速或mod_php的)运行 [英] Find out how PHP is running on server (CGI OR fastCGI OR mod_php)

查看:121
本文介绍了了解如何PHP是在服务器上(CGI或快速或mod_php的)运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用共同主办。

有可能找出是否PHP是通过FastCGI的运行(或者CGI)或Apache模块 mod_php的

There is possible to find out whether PHP is running via fastCGI (or maybe CGI) or as Apache module mod_php?

是不是可能通过自己找出来,不求回报的主机托管服务提供商?

Is it possibly to find out by myself, without asking the hoster?

推荐答案

这就是服务器API 上的 phpinfo()函数的输出

不过,请注意,它不会告诉你的Apache或确切版本确切的CGI处理程序。它只是描述了使用SAPI。

However, please note that it won't tell you the exact version of Apache or the exact CGI handler. It just describes the SAPI in use.

您也可以致电 php_sapi_name()函数(或的 PHP_SAPI 常量,它提供了相同的信息):

You can also call the php_sapi_name() function (or the PHP_SAPI constant, which provides the same info):

说明

字符串php_sapi_name(无效)

返回描述接口类型(小写字符串
  服务器API,SAPI)PHP是使用。例如,在CLI PHP这
  字符串将是(CLI),而与Apache它可能有几种不同的
  根据所使用的确切的SAPI值

Returns a lowercase string that describes the type of interface (the Server API, SAPI) that PHP is using. For example, in CLI PHP this string will be "cli" whereas with Apache it may have several different values depending on the exact SAPI used

它仍然是一个好主意,检查你的HSP的文档,因为它有多个PHP版本可能。

It's still a good idea to check your HSP's documentation because it possible to have several PHP versions available.

记住,你需要运行的phpinfo()从您要检查(Web服务器不会告诉你有关命令行,反之亦然相同的环境):

Remember you need to run phpinfo() from the same environment you want to check (web server won't tell you about command line and vice-versa):

C:\>php -i | findstr /C:"Server API"
Server API => Command Line Interface

这篇关于了解如何PHP是在服务器上(CGI或快速或mod_php的)运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆