nlopess Sun Jul 31 07:45:31 2005 EDT
Modified files: /phpdoc/en/features commandline.xml Log: remove nested <para>s in notes remove oldie comments expand the '-a' interactive shell docs http://cvs.php.net/diff.php/phpdoc/en/features/commandline.xml?r1=1.39&r2=1.40&ty=u Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.39 phpdoc/en/features/commandline.xml:1.40 --- phpdoc/en/features/commandline.xml:1.39 Sun May 15 14:34:33 2005 +++ phpdoc/en/features/commandline.xml Sun Jul 31 07:45:31 2005 @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.39 $ --> +<!-- $Revision: 1.40 $ --> <chapter id="features.commandline"> <title>Using PHP from the command line</title> - <!-- NEW DOCUMENTATION STARTS --> <para> As of version 4.3.0, PHP supports a new <literal>SAPI</literal> type (Server Application Programming Interface) @@ -42,17 +41,15 @@ install</command>. Alternatively you can specify <option role="configure"> --disable-cgi</option> in your configure line. </para> - <para> - <note> - <para> - Because both <option role="configure">--enable-cli</option> and - <option role="configure">--enable-cgi</option> are enabled by default, - simply having <option role="configure">--enable-cli</option> in your - configure line does not necessarily mean the CLI will be copied as - <filename>{PREFIX}/bin/php</filename> during <command>make install</command>. - </para> - </note> - </para> + <note> + <para> + Because both <option role="configure">--enable-cli</option> and + <option role="configure">--enable-cgi</option> are enabled by default, + simply having <option role="configure">--enable-cli</option> in your + configure line does not necessarily mean the CLI will be copied as + <filename>{PREFIX}/bin/php</filename> during <command>make install</command>. + </para> + </note> <para> The windows packages between PHP 4.2.0 and PHP 4.2.3 distributed the CLI as <filename>php-cli.exe</filename>, living in the same folder as the CGI @@ -70,25 +67,21 @@ This behavior is similar to php-gtk. You should configure with <option role="configure">--enable-cli-win32</option>. </para> - <para> - <note> - <title>What SAPI do I have?</title> - <para> - From a shell, typing <command>php -v</command> will tell you - whether <filename>php</filename> is CGI or CLI. See also the function - <function>php_sapi_name</function> and the constant <constant> - PHP_SAPI</constant>. - </para> - </note> - </para> - <para> - <note> - <para> - A Unix <literal>man</literal>ual page was added in PHP 4.3.2. You may - view this by typing <command>man php</command> in your shell environment. - </para> - </note> - </para> + <note> + <title>What SAPI do I have?</title> + <para> + From a shell, typing <command>php -v</command> will tell you + whether <filename>php</filename> is CGI or CLI. See also the function + <function>php_sapi_name</function> and the constant <constant> + PHP_SAPI</constant>. + </para> + </note> + <note> + <para> + A Unix <literal>man</literal>ual page was added in PHP 4.3.2. You may + view this by typing <command>man php</command> in your shell environment. + </para> + </note> <para> Remarkable differences of the <literal>CLI SAPI</literal> compared to other <literal>SAPI</literal>s: @@ -361,6 +354,7 @@ php [options] [-B <begin_code>] -R <code> [-E <end_code>] [--] [args...] php [options] [-B <begin_code>] -F <file> [-E <end_code>] [--] [args...] php [options] -- [args...] + php [options] -a -a Run interactively -c <path>|<file> Look for php.ini file in this directory @@ -551,7 +545,13 @@ <entry>--interactive</entry> <entry> <para> - Runs PHP interactively. + Runs PHP interactively. If you compile PHP with the <link + linkend="ref.readline">Readline</link> extension (which is not + available on windows), you'll have a nice shell, including a + completion feature (e.g. you can start typing a variable name, hit the + TAB key and PHP completes its name) and a typing history that can be + accessed using the arrow keys. The history is saved in the + <filename>~/.php_history</filename> file. </para> </entry> </row> @@ -915,35 +915,7 @@ </tgroup> </table> </para> - <!-- NEW DOCUMENTATION ENDS --> - <!-- OLD DOCUMENTED STARTS - mfischer, 20020510: I've commented out the start paragraphs of the old - documentation as it is meant to be replaced by the new one. - <para> - The command line options of the PHP executable are useful - if you would like to debug or test your PHP setup, but they - can also be handy, if you would like to use PHP for a - different purpose than web scripting. - </para> - <para> - Note, that you can always direct the output of the PHP - executable to an external file with the > character, - so <literal>php -q test.php > test.html</literal> will - print out the output of <filename>test.php</filename> - without HTTP headers to the <filename>test.html</filename> - file in the same directory. - </para> - <para> - You can only use these command line options if you have - the PHP executable. If you built the server module - version, and you have no CGI version available on your - machine, than you have no chance to use these options. - For Windows users both the PHP executable and the server - modules are in the binary package, the executable is - named <filename>php.exe</filename>. - </para> - --> <para> The PHP executable can be used to run PHP scripts absolutely independent from the web server. If you are on a Unix system, you should add a special @@ -1014,7 +986,7 @@ <title>Batch file to run a command line PHP script (script.bat)</title> <programlisting role="shell"> <![CDATA[ [EMAIL PROTECTED]:\php\cli\php.exe script.php %1 %2 %3 %4 [EMAIL PROTECTED]:\php\php.exe script.php %1 %2 %3 %4 ]]> </programlisting> </example> @@ -1023,7 +995,7 @@ Assuming you named the above program <filename>script.php</filename>, and you have your CLI <filename>php.exe</filename> in - <filename>c:\php\cli\php.exe</filename> this batch file + <filename>C:\php\php.exe</filename> this batch file will run it for you with your added options: <command>script.bat echothis</command> or <command>script.bat -h</command>.