- Use <acronym> for acronyms

- Slight rephrase of the introduction


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@293671 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Hannes Magnusson 2010-01-17 21:57:28 +00:00
parent b942032e4f
commit f9d005c207

View file

@ -3,23 +3,20 @@
<chapter xml:id="features.commandline" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Using PHP from the command line</title>
<para>
As of version 4.3.0, PHP supports a new
<literal>SAPI</literal> type (<literal>Server Application Programming Interface</literal>)
named <literal>CLI</literal> which means <emphasis>Command Line
Interface</emphasis>. As the name implies, this <literal>SAPI</literal> type
main focus is on developing shell (or desktop as well) applications with
PHP. There are quite a few differences between the
<literal>CLI SAPI</literal> and other <literal>SAPI</literal>s which are
explained in this chapter. It's worth mentioning
that <literal>CLI</literal> and <literal>CGI</literal> are different
SAPI's although they do share many of the same behaviors.
PHP supports a <acronym>CLI</acronym> <acronym>SAPI</acronym> as of PHP 4.3.0.
The main focus of this <acronym>SAPI</acronym> is for developing shell
applications with PHP. There are quite a few differences between the
<acronym>CLI</acronym> <acronym>SAPI</acronym> and other
<acronym>SAPI</acronym>s which are explained in this chapter. It is worth
mentioning that <acronym>CLI</acronym> and <acronym>CGI</acronym> are different
<acronym>SAPI</acronym>'s although they do share many of the same behaviors.
</para>
<para>
The <literal>CLI SAPI</literal> was released for the first time with
The <acronym>CLI</acronym> <acronym>SAPI</acronym> was released for the first time with
PHP 4.2.0, but was still experimental and had
to be explicitly enabled with <option role="configure">--enable-cli</option> when running
<command>./configure</command>. Since PHP 4.3.0 the
<literal>CLI SAPI</literal> is no longer experimental and the option
<acronym>CLI</acronym> <acronym>SAPI</acronym> is no longer experimental and the option
<option role="configure">--enable-cli</option> is on by default. You may use
<option role="configure">--disable-cli</option> to disable it.
</para>
@ -83,8 +80,8 @@
</para>
</note>
<para>
Remarkable differences of the <literal>CLI SAPI</literal> compared to other
<literal>SAPI</literal>s:
Remarkable differences of the <acronym>CLI</acronym> <acronym>SAPI</acronym> compared to other
<acronym>SAPI</acronym>s:
<itemizedlist>
<listitem>
<para>
@ -122,7 +119,7 @@
<thead>
<row>
<entry>Directive</entry>
<entry><literal>CLI SAPI</literal> default value</entry>
<entry><acronym>CLI</acronym> <acronym>SAPI</acronym> default value</entry>
<entry>Comment</entry>
</row>
</thead>
@ -166,14 +163,14 @@
Because this setting is &true; you will always have access to
<emphasis>argc</emphasis> (number of arguments passed to the
application) and <emphasis>argv</emphasis> (array of the actual
arguments) in the <literal>CLI SAPI</literal>.
arguments) in the <acronym>CLI</acronym> <acronym>SAPI</acronym>.
</para>
<para>
As of PHP 4.3.0, the PHP variables <varname>$argc</varname>
and <varname>$argv</varname> are registered and filled in with the appropriate
values when using the <literal>CLI SAPI</literal>. Prior to this version,
values when using the <acronym>CLI</acronym> <acronym>SAPI</acronym>. Prior to this version,
the creation of these variables behaved as they do in
<literal>CGI</literal> and <literal>MODULE</literal> versions
<acronym>CGI</acronym> and <literal>MODULE</literal> versions
which requires the PHP directive
<link linkend="ini.register-globals">register_globals</link> to
be <emphasis>on</emphasis>. Regardless of version or register_globals
@ -306,7 +303,7 @@ php -r 'fwrite(STDERR, "stderr\n");'
</listitem>
<listitem>
<para>
The <literal>CLI SAPI</literal> does <emphasis
The <acronym>CLI</acronym> <acronym>SAPI</acronym> does <emphasis
role="strong">not</emphasis> change the current directory to the directory
of the executed script!
</para>
@ -323,7 +320,7 @@ echo getcwd(), "\n";
]]>
</programlisting>
<para>
When using the <literal>CGI</literal> version, the output is:
When using the <acronym>CGI</acronym> version, the output is:
</para>
<screen>
<![CDATA[
@ -339,7 +336,7 @@ $ php -q another_directory/test.php
directory to the one of the executed script.
</para>
<para>
Using the <literal>CLI SAPI</literal> yields:
Using the <acronym>CLI</acronym> <acronym>SAPI</acronym> yields:
</para>
<screen>
<![CDATA[
@ -356,7 +353,7 @@ $ php -f another_directory/test.php
</informalexample>
<note>
<para>
The <literal>CGI SAPI</literal> supports this <literal>CLI SAPI</literal>
The <literal>CGI SAPI</literal> supports this <acronym>CLI</acronym> <acronym>SAPI</acronym>
behaviour by means of the <option>-C</option> switch when run from the
command line.
</para>
@ -411,7 +408,7 @@ Usage: php [options] [-f] <file> [--] [args...]
</screen>
</para>
<para>
The <literal>CLI SAPI</literal> has three different ways of getting the
The <acronym>CLI</acronym> <acronym>SAPI</acronym> has three different ways of getting the
PHP code you want to execute:
<orderedlist>
<listitem>