mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-19 10:28:54 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@297028 c90b9560-bf6c-de11-be94-00142212c4b1
117 lines
3.3 KiB
XML
117 lines
3.3 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<refentry xml:id="function.php-sapi-name" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>php_sapi_name</refname>
|
|
<refpurpose>Returns the type of interface between web server and PHP</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>php_sapi_name</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<simpara>
|
|
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. Possible values are listed
|
|
below.
|
|
</simpara>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns the interface type, as a lowercase string.
|
|
</para>
|
|
<para>
|
|
Although not exhaustive, the possible return values include
|
|
<literal>aolserver</literal>, <literal>apache</literal>,
|
|
<literal>apache2filter</literal>, <literal>apache2handler</literal>,
|
|
<literal>caudium</literal>, <literal>cgi</literal> (until PHP 5.3),
|
|
<literal>cgi-fcgi</literal>, <literal>cli</literal>,
|
|
<literal>continuity</literal>, <literal>embed</literal>,
|
|
<literal>isapi</literal>, <literal>litespeed</literal>,
|
|
<literal>milter</literal>, <literal>nsapi</literal>,
|
|
<literal>phttpd</literal>, <literal>pi3web</literal>, <literal>roxen</literal>,
|
|
<literal>thttpd</literal>, <literal>tux</literal>, and <literal>webjames</literal>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><function>php_sapi_name</function> example</title>
|
|
<para>
|
|
This example checks for the substring <literal>cgi</literal>
|
|
because it may also be <literal>cgi-fcgi</literal>.
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$sapi_type = php_sapi_name();
|
|
if (substr($sapi_type, 0, 3) == 'cgi') {
|
|
echo "You are using CGI PHP\n";
|
|
} else {
|
|
echo "You are not using CGI PHP\n";
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
<note>
|
|
<title>An alternative approach</title>
|
|
<para>
|
|
The PHP constant <constant>PHP_SAPI</constant> has the same value
|
|
as <function>php_sapi_name</function>.
|
|
</para>
|
|
</note>
|
|
<tip>
|
|
<title>A potential gotcha</title>
|
|
<para>
|
|
The defined <acronym>SAPI</acronym> may not be obvious, because for
|
|
example instead of <literal>apache</literal> it may be defined as
|
|
<literal>apache2handler</literal> or <literal>apache2filter</literal>.
|
|
</para>
|
|
</tip>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><link linkend="reserved.constants.core">PHP_SAPI</link></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|