[PHP-DOC] cvs: phpdoc /en/features commandline.xml
bjori Tue May 22 16:35:10 2007 UTC Modified files: /phpdoc/en/features commandline.xml Log: - Sync php -h output with 5.2.3 - Document --ini (no, there is no short-option) - Add note for --rf, rc re that ext/reflection is required http://cvs.php.net/viewvc.cgi/phpdoc/en/features/commandline.xml?r1=1.47r2=1.48diff_format=u Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.47 phpdoc/en/features/commandline.xml:1.48 --- phpdoc/en/features/commandline.xml:1.47 Mon May 14 10:02:11 2007 +++ phpdoc/en/features/commandline.xml Tue May 22 16:35:10 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.47 $ -- +!-- $Revision: 1.48 $ -- chapter id=features.commandline titleUsing PHP from the command line/title para @@ -361,7 +361,7 @@ php [options] -- [args...] php [options] -a - -a Run as interactive shell + -a Run interactively -c path|file Look for php.ini file in this directory -n No php.ini file will be used -d foo[=bar] Define INI entry foo with value 'bar' @@ -385,6 +385,8 @@ args... Arguments passed to script. Use -- args when first argument starts with - or script is read from stdin + --iniShow configuration file names + --rf name Show information about function name. --rc name Show information about class name. --re name Show information about extension name. @@ -980,6 +982,28 @@ /entry /row row + entry/entry + entry--ini/entry + entry + para +Shows configuration file names and scanned directories. Available as +of PHP 5.2.3. +example + titleliteral--ini/literal example/title + programlisting role=shell +![CDATA[ +$ php --ini +Configuration File (php.ini) Path: /usr/dev/php/5.2/lib +Loaded Configuration File: /usr/dev/php/5.2/lib/php.ini +Scan for additional .ini files in: (none) +Additional .ini files parsed: (none) +]] + /programlisting +/example + /para + /entry + /row + row entry--rf/entry entry--rfunction/entry entry @@ -988,6 +1012,10 @@ number and name of the parameters). Available as of PHP 5.1.2. /para para +This option is only available if PHP was compiled with +link linkend=language.oop5.reflectionReflection/link support. + /para + para example titlebasic literal--rf/literal usage/title programlisting role=shell @@ -1014,7 +1042,11 @@ Show information about the given class (list of constants, properties and methods). Available as of PHP 5.1.2. /para - /entry + para +This option is only available if PHP was compiled with +link linkend=language.oop5.reflectionReflection/link support. + /para + /entry /row row entry--re/entry @@ -1024,6 +1056,10 @@ Show information about the given extension (list of php.ini; options, defined functions, constants and classes). Available as of PHP 5.1.2. /para + para +This option is only available if PHP was compiled with +link linkend=language.oop5.reflectionReflection/link support. + /para /entry /row row
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
bjori Tue May 22 17:07:23 2007 UTC Modified files: /phpdoc/en/features commandline.xml Log: Add examples for --rc, --re, --ri Fix typo http://cvs.php.net/viewvc.cgi/phpdoc/en/features/commandline.xml?r1=1.48r2=1.49diff_format=u Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.48 phpdoc/en/features/commandline.xml:1.49 --- phpdoc/en/features/commandline.xml:1.48 Tue May 22 16:35:10 2007 +++ phpdoc/en/features/commandline.xml Tue May 22 17:07:23 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.48 $ -- +!-- $Revision: 1.49 $ -- chapter id=features.commandline titleUsing PHP from the command line/title para @@ -1046,7 +1046,42 @@ This option is only available if PHP was compiled with link linkend=language.oop5.reflectionReflection/link support. /para - /entry + para +example + titleliteral--rc/literal example/title + programlisting role=shell +![CDATA[ +$ php --rc Directory +Class [ internal:standard class Directory ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [3] { +Method [ internal public method close ] { +} + +Method [ internal public method rewind ] { +} + +Method [ internal public method read ] { +} + } +} +]] + /programlisting +/example + /para + /entry /row row entry--re/entry @@ -1060,16 +1095,60 @@ This option is only available if PHP was compiled with link linkend=language.oop5.reflectionReflection/link support. /para + para +example + titleliteral--re/literal example/title + programlisting role=shell +![CDATA[ +$ php --re json +Extension [ persistent extension #19 json version 1.2.1 ] { + + - Functions { +Function [ internal function json_encode ] { +} +Function [ internal function json_decode ] { +} + } +} +]] + /programlisting +/example + /para /entry /row row - entry-ri/entry + entry--ri/entry entry--rextinfo/entry entry para Shows the configuration information for the given extension (the same information that is returned by functionphpinfo/function). -Available as of PHP 5.2.2. +Available as of PHP 5.2.2. The core configuration information +are available using main as extension name. + /para + para +example + titleliteral--ri/literal example/title + programlisting role=shell +![CDATA[ +$ php --ri date + +date + +date/time support = enabled +Olson Timezone Database Version = 2007.5 +Timezone Database = internal +Default timezone = Europe/Oslo + +Directive = Local Value = Master Value +date.timezone = Europe/Oslo = Europe/Oslo +date.default_latitude = 59.22482 = 59.22482 +date.default_longitude = 11.018084 = 11.018084 +date.sunset_zenith = 90.58 = 90.58 +date.sunrise_zenith = 90.58 = 90.58 +]] + /programlisting +/example /para /entry /row
[PHP-DOC] cvs: phpdoc /en/features commandline.xml /en/language/oop5 autoload.xml
rquadling Mon May 14 10:02:11 2007 UTC Modified files: /phpdoc/en/features commandline.xml /phpdoc/en/language/oop5autoload.xml Log: FIX #40775 : PHP -a and __autoload() don't mix. http://cvs.php.net/viewvc.cgi/phpdoc/en/features/commandline.xml?r1=1.46r2=1.47diff_format=u Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.46 phpdoc/en/features/commandline.xml:1.47 --- phpdoc/en/features/commandline.xml:1.46 Thu Feb 15 09:24:34 2007 +++ phpdoc/en/features/commandline.xml Mon May 14 10:02:11 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.46 $ -- +!-- $Revision: 1.47 $ -- chapter id=features.commandline titleUsing PHP from the command line/title para @@ -585,6 +585,12 @@ defined before called. /para /note + note +para + link linkend=language.oop5.autoloadAutoloading/link is not available if using PHP in CLI + interactive mode. +/para + /note /entry /row row http://cvs.php.net/viewvc.cgi/phpdoc/en/language/oop5/autoload.xml?r1=1.6r2=1.7diff_format=u Index: phpdoc/en/language/oop5/autoload.xml diff -u phpdoc/en/language/oop5/autoload.xml:1.6 phpdoc/en/language/oop5/autoload.xml:1.7 --- phpdoc/en/language/oop5/autoload.xml:1.6Mon Feb 14 04:13:13 2005 +++ phpdoc/en/language/oop5/autoload.xmlMon May 14 10:02:11 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.6 $ -- +!-- $Revision: 1.7 $ -- sect1 id=language.oop5.autoload titleAutoloading Objects/title para @@ -22,6 +22,12 @@ a fatal error. /para /note + note + para +Autoloading is not available if using PHP in CLI +link linkend=features.commandlineinteractive mode/link. + /para + /note para example titleAutoload example/title
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
nlopess Sun Feb 11 14:01:31 2007 UTC Modified files: /phpdoc/en/features commandline.xml Log: document --r* switches http://cvs.php.net/viewvc.cgi/phpdoc/en/features/commandline.xml?r1=1.44r2=1.45diff_format=u Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.44 phpdoc/en/features/commandline.xml:1.45 --- phpdoc/en/features/commandline.xml:1.44 Mon Feb 5 21:01:02 2007 +++ phpdoc/en/features/commandline.xml Sun Feb 11 14:01:31 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.44 $ -- +!-- $Revision: 1.45 $ -- chapter id=features.commandline titleUsing PHP from the command line/title para @@ -361,12 +361,12 @@ php [options] -- [args...] php [options] -a - -a Run interactively + -a Run as interactive shell -c path|file Look for php.ini file in this directory -n No php.ini file will be used -d foo[=bar] Define INI entry foo with value 'bar' -e Generate extended information for debugger/profiler - -f fileParse file. + -f fileParse and execute file. -h This help -i PHP information -l Syntax check only (lint) @@ -384,6 +384,11 @@ args... Arguments passed to script. Use -- args when first argument starts with - or script is read from stdin + + --rf name Show information about function name. + --rc name Show information about class name. + --re name Show information about extension name. + --ri name Show configuration for extension name. ]] /screen /para @@ -968,6 +973,64 @@ /para /entry /row + row + entry--rf/entry + entry--rfunction/entry + entry + para +Shows information about the given function or class method (e.g. +number and name of the parameters). Available as of PHP 5.1.2. + /para + para +example + titlebasic literal--rf/literal usage/title + programlisting role=shell +![CDATA[ +$ php --rf var_dump +Function [ internal public function var_dump ] { + + - Parameters [2] { +Parameter #0 [ required $var ] +Parameter #1 [ optional $... ] + } +} +]] + /programlisting +/example + /para + /entry + /row + row + entry--rc/entry + entry--rclass/entry + entry + para +Show information about the given class (list of constants, properties +and methods). Available as of PHP 5.1.2. + /para + /entry + /row + row + entry--re/entry + entry--rextension/entry + entry + para +Show information about the given extension (list of php.ini; options, +defined functions, constants and classes). Available as of PHP 5.1.2. + /para + /entry + /row + row + entry-ri/entry + entry--rextinfo/entry + entry + para +Shows the configuration information for the given extension (the same +information that is returned by functionphpinfo/function). +Available as of PHP 5.2.2. + /para + /entry + /row /tbody /tgroup /table
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
bjori Mon Feb 5 20:19:25 2007 UTC Modified files: /phpdoc/en/features commandline.xml Log: Improve markup http://cvs.php.net/viewvc.cgi/phpdoc/en/features/commandline.xml?r1=1.41r2=1.42diff_format=u Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.41 phpdoc/en/features/commandline.xml:1.42 --- phpdoc/en/features/commandline.xml:1.41 Mon Sep 5 09:33:41 2005 +++ phpdoc/en/features/commandline.xml Mon Feb 5 20:19:25 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.41 $ -- +!-- $Revision: 1.42 $ -- chapter id=features.commandline titleUsing PHP from the command line/title para @@ -294,8 +294,10 @@ role=strongnot/emphasis change the current directory to the directory of the executed script! /para +example para Example showing the difference to the literalCGI SAPI/literal: + /para programlisting role=php ![CDATA[ ?php @@ -304,9 +306,9 @@ ? ]] /programlisting -/para para When using the literalCGI/literal version, the output is: + /para screen ![CDATA[ $ pwd @@ -316,11 +318,13 @@ /tmp/another_directory ]] /screen + para This clearly shows that PHP changes its current directory to the one of the executed script. /para para Using the literalCLI SAPI/literal yields: + /para screen ![CDATA[ $ pwd @@ -330,9 +334,10 @@ /tmp ]] /screen - This allows greater flexibility when writing shell tools in - PHP. + para + This allows greater flexibility when writing shell tools in PHP. /para +/example note para The literalCGI SAPI/literal supports this literalCLI SAPI/literal @@ -390,7 +395,7 @@ para Telling PHP to execute a certain file. /para -para +example screen ![CDATA[ php my_script.php @@ -398,6 +403,8 @@ php -f my_script.php ]] /screen +/example +para Both ways (whether using the option-f/option switch or not) execute the file filenamemy_script.php/filename. You can choose any file to execute - your PHP scripts do not have to end with the @@ -410,12 +417,14 @@ Pass the PHP code to execute directly on the command line. /para -para +example screen ![CDATA[ php -r 'print_r(get_defined_constants());' ]] /screen +/example +para Special care has to be taken in regards of shell variable substitution and quoting usage. /para @@ -436,12 +445,14 @@ This gives the powerful ability to dynamically create PHP code and feed it to the binary, as shown in this (fictional) example: +/para +example screen ![CDATA[ $ some_application | some_filter | php | sort -u final_output.txt ]] /screen -/para +/example /listitem /orderedlist You cannot combine any of the three ways to execute code. @@ -471,7 +482,7 @@ PHP, every argument following it is passed untouched to your script. /para - para + example screen ![CDATA[ # This will not execute the given code but will show the PHP usage @@ -489,7 +500,7 @@ } ]] /screen - /para + /example para However, there's another way of using PHP for shell scripting. You can write a script where the first line starts with @@ -498,6 +509,9 @@ starting and end tags. Once you have set the execution attributes of the file appropriately (e.g. commandchmod +x test/command) your script can be executed like a normal shell or perl script: + /para + example + titleExecute PHP script as shell script/title programlisting role=php ![CDATA[ #!/usr/bin/php @@ -506,8 +520,10 @@ ? ]] /programlisting + para Assuming this file is named filenametest/filename in the current directory, we can now do the following: + /para screen ![CDATA[ $ chmod +x test @@ -524,6 +540,8 @@ } ]] /screen + /example + para As you see, in this case no care needs to be taken when passing parameters which start with literal-/literal to your script. /para @@ -569,9 +587,11 @@ entry--php-ini/entry entry para -With this option one can either specify a directory where to look for -php.ini; or you can specify a custom literalINI/literal file -directly (which does not need to be named php.ini;), e.g.: +This option can either specify a directory where to look for +php.ini; or specify a custom literalINI/literal file +(which does not need to be named php.ini;), e.g.: + /para + example screen ![CDATA[ $ php -c /custom/directory/ my_script.php @@ -579,6 +599,8 @@ $ php -c /custom/directory/custom-file.ini my_script.php ]] /screen + /example + para If you don't specify this option, file is searched in link linkend=configuration.filedefault locations/link. /para @@ -606,8
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
bjori Mon Feb 5 20:20:16 2007 UTC Modified files: /phpdoc/en/features commandline.xml Log: WS after markup changes http://cvs.php.net/viewvc.cgi/phpdoc/en/features/commandline.xml?r1=1.42r2=1.43diff_format=u Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.42 phpdoc/en/features/commandline.xml:1.43 --- phpdoc/en/features/commandline.xml:1.42 Mon Feb 5 20:19:25 2007 +++ phpdoc/en/features/commandline.xml Mon Feb 5 20:20:16 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.42 $ -- +!-- $Revision: 1.43 $ -- chapter id=features.commandline titleUsing PHP from the command line/title para @@ -295,8 +295,8 @@ of the executed script! /para example -para - Example showing the difference to the literalCGI SAPI/literal: + para + Example showing the difference to the literalCGI SAPI/literal: /para programlisting role=php ![CDATA[ @@ -306,8 +306,8 @@ ? ]] /programlisting -para - When using the literalCGI/literal version, the output is: + para + When using the literalCGI/literal version, the output is: /para screen ![CDATA[ @@ -319,11 +319,11 @@ ]] /screen para - This clearly shows that PHP changes its current - directory to the one of the executed script. -/para -para - Using the literalCLI SAPI/literal yields: + This clearly shows that PHP changes its current + directory to the one of the executed script. + /para + para + Using the literalCLI SAPI/literal yields: /para screen ![CDATA[ @@ -336,7 +336,7 @@ /screen para This allows greater flexibility when writing shell tools in PHP. -/para + /para /example note para @@ -521,8 +521,8 @@ ]] /programlisting para - Assuming this file is named filenametest/filename in the current - directory, we can now do the following: +Assuming this file is named filenametest/filename in the current +directory, we can now do the following: /para screen ![CDATA[ @@ -629,8 +629,8 @@ /screen /para example - para -Examples (lines are wrapped for layout reasons): +para + Examples (lines are wrapped for layout reasons): /para screen ![CDATA[ @@ -729,9 +729,9 @@ entry--modules/entry entry example - para -Using this option, PHP prints out the built in (and loaded) PHP and -Zend modules: +para + Using this option, PHP prints out the built in (and loaded) PHP and + Zend modules: /para screen ![CDATA[ @@ -772,8 +772,8 @@ shell. /para example -para - Example showing a parser error + para + Example showing a parser error /para screen ![CDATA[ @@ -886,8 +886,8 @@ /para example titleUsing the option-B/option, option-R/option and -option-E/option options to count the number of lines of a -project. + option-E/option options to count the number of lines of a + project. /title screen ![CDATA[ @@ -925,8 +925,8 @@ entry--version/entry entry example - para -Writes the PHP, PHP SAPI, and Zend version to standard output, e.g. +para + Writes the PHP, PHP SAPI, and Zend version to standard output, e.g. /para screen ![CDATA[
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
bjori Mon Feb 5 21:01:02 2007 UTC Modified files: /phpdoc/en/features commandline.xml Log: Whopsy. Lets make docbook happy and replace title less examples with informalexample http://cvs.php.net/viewvc.cgi/phpdoc/en/features/commandline.xml?r1=1.43r2=1.44diff_format=u Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.43 phpdoc/en/features/commandline.xml:1.44 --- phpdoc/en/features/commandline.xml:1.43 Mon Feb 5 20:20:16 2007 +++ phpdoc/en/features/commandline.xml Mon Feb 5 21:01:02 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.43 $ -- +!-- $Revision: 1.44 $ -- chapter id=features.commandline titleUsing PHP from the command line/title para @@ -294,7 +294,7 @@ role=strongnot/emphasis change the current directory to the directory of the executed script! /para -example +informalexample para Example showing the difference to the literalCGI SAPI/literal: /para @@ -337,7 +337,7 @@ para This allows greater flexibility when writing shell tools in PHP. /para -/example +/informalexample note para The literalCGI SAPI/literal supports this literalCLI SAPI/literal @@ -395,7 +395,7 @@ para Telling PHP to execute a certain file. /para -example +informalexample screen ![CDATA[ php my_script.php @@ -403,7 +403,7 @@ php -f my_script.php ]] /screen -/example +/informalexample para Both ways (whether using the option-f/option switch or not) execute the file filenamemy_script.php/filename. You can choose any file to @@ -417,13 +417,13 @@ Pass the PHP code to execute directly on the command line. /para -example +informalexample screen ![CDATA[ php -r 'print_r(get_defined_constants());' ]] /screen -/example +/informalexample para Special care has to be taken in regards of shell variable substitution and quoting usage. @@ -446,13 +446,13 @@ PHP code and feed it to the binary, as shown in this (fictional) example: /para -example +informalexample screen ![CDATA[ $ some_application | some_filter | php | sort -u final_output.txt ]] /screen -/example +/informalexample /listitem /orderedlist You cannot combine any of the three ways to execute code. @@ -482,7 +482,7 @@ PHP, every argument following it is passed untouched to your script. /para - example + informalexample screen ![CDATA[ # This will not execute the given code but will show the PHP usage @@ -500,7 +500,7 @@ } ]] /screen - /example + /informalexample para However, there's another way of using PHP for shell scripting. You can write a script where the first line starts with @@ -591,7 +591,7 @@ php.ini; or specify a custom literalINI/literal file (which does not need to be named php.ini;), e.g.: /para - example + parainformalexample screen ![CDATA[ $ php -c /custom/directory/ my_script.php @@ -599,7 +599,7 @@ $ php -c /custom/directory/custom-file.ini my_script.php ]] /screen - /example + /informalexample/para para If you don't specify this option, file is searched in link linkend=configuration.filedefault locations/link. @@ -628,7 +628,7 @@ ]] /screen /para - example + parainformalexample para Examples (lines are wrapped for layout reasons): /para @@ -654,7 +654,7 @@ string(15) doesntmakesense ]] /screen - /example + /informalexample/para /entry /row row @@ -728,7 +728,7 @@ entry-m/entry entry--modules/entry entry - example + parainformalexample para Using this option, PHP prints out the built in (and loaded) PHP and Zend modules: @@ -751,7 +751,7 @@ [Zend Modules] ]] /screen - /example + /informalexample/para /entry /row row @@ -771,7 +771,7 @@ to not collide with command line variable substitution done by the shell. /para -example +informalexample para Example showing a parser error /para @@ -781,7 +781,7 @@ Command line code(1) : Parse error - parse error, unexpected '=' ]] /screen -/example +/informalexample para The problem here is that the sh/bash performs variable substitution even when using double quotes literal/literal. Since the @@ -789,7 +789,7 @@ expands to nothing which results in the code passed to PHP for execution actually reading: /para -example +informalexample screen ![CDATA[ $ php -r = get_defined_constants(); @@ -816,7 +816,7 @@ [...] ]]
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
vrana Mon Sep 5 05:33:45 2005 EDT Modified files: /phpdoc/en/features commandline.xml Log: auto_prepend_file with -a and -r (bug #34367) http://cvs.php.net/diff.php/phpdoc/en/features/commandline.xml?r1=1.40r2=1.41ty=u Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.40 phpdoc/en/features/commandline.xml:1.41 --- phpdoc/en/features/commandline.xml:1.40 Sun Jul 31 07:45:31 2005 +++ phpdoc/en/features/commandline.xml Mon Sep 5 05:33:41 2005 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.40 $ -- +!-- $Revision: 1.41 $ -- chapter id=features.commandline titleUsing PHP from the command line/title para @@ -553,6 +553,15 @@ accessed using the arrow keys. The history is saved in the filename~/.php_history/filename file. /para + note +para + Files included through link + linkend=ini.auto-prepend-fileauto_prepend_file/link and link + linkend=ini.auto-append-fileauto_append_file/link are parsed in + this mode but with some restrictions - e.g. functions have to be + defined before called. +/para + /note /entry /row row @@ -787,6 +796,15 @@ SAPI and not in the emphasisCGI/emphasis SAPI. /para /note + note +para + This option is meant for a very basic stuff. Thus some configuration + directives (e.g. link + linkend=ini.auto-prepend-fileauto_prepend_file/link and link + linkend=ini.auto-append-fileauto_append_file/link) are ignored + in this mode. +/para + /note /entry /row row
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
nlopess Sun Jul 31 07:45:31 2005 EDT Modified files: /phpdoc/en/features commandline.xml Log: remove nested paras in notes remove oldie comments expand the '-a' interactive shell docs http://cvs.php.net/diff.php/phpdoc/en/features/commandline.xml?r1=1.39r2=1.40ty=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 titleUsing PHP from the command line/title - !-- NEW DOCUMENTATION STARTS -- para As of version 4.3.0, PHP supports a new literalSAPI/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 commandmake 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 commandmake install/command. + /para + /note para The windows packages between PHP 4.2.0 and PHP 4.2.3 distributed the CLI as filenamephp-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 - titleWhat SAPI do I have?/title - para -From a shell, typing commandphp -v/command will tell you -whether filenamephp/filename is CGI or CLI. See also the function -functionphp_sapi_name/function and the constant constant -PHP_SAPI/constant. - /para - /note - /para - para - note - para -A Unix literalman/literalual page was added in PHP 4.3.2. You may -view this by typing commandman php/command in your shell environment. - /para - /note - /para + note + titleWhat SAPI do I have?/title + para + From a shell, typing commandphp -v/command will tell you + whether filenamephp/filename is CGI or CLI. See also the function + functionphp_sapi_name/function and the constant constant + PHP_SAPI/constant. + /para + /note + note + para + A Unix literalman/literalual page was added in PHP 4.3.2. You may + view this by typing commandman php/command in your shell environment. + /para + /note para Remarkable differences of the literalCLI SAPI/literal compared to other literalSAPI/literals: @@ -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.readlineReadline/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 gt; character, - so literalphp -q test.php gt; test.html/literal will - print out the output of filenametest.php/filename - without HTTP headers to the filenametest.html/filename - file in the same directory. - /para - para -
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
nlopess Sun May 15 14:34:34 2005 EDT Modified files: /phpdoc/en/features commandline.xml Log: reorder opts according to 'php -h'. add -B, -R, -F and -E. More to come later (docs for -a, for example..) http://cvs.php.net/diff.php/phpdoc/en/features/commandline.xml?r1=1.38r2=1.39ty=u Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.38 phpdoc/en/features/commandline.xml:1.39 --- phpdoc/en/features/commandline.xml:1.38 Thu Oct 28 05:29:33 2004 +++ phpdoc/en/features/commandline.xml Sun May 15 14:34:33 2005 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.38 $ -- +!-- $Revision: 1.39 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- @@ -356,25 +356,34 @@ option-h/option switch: screen ![CDATA[ -Usage: php [options] [-f] file [args...] - php [options] -r code [args...] - php [options] [-- args...] - -s Display colour syntax highlighted source. - -w Display source with stripped comments and whitespace. - -f fileParse file. - -v Version number - -c path|file Look for php.ini file in this directory +Usage: php [options] [-f] file [--] [args...] + php [options] -r code [--] [args...] + 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...] + -a Run interactively + -c path|file Look for php.ini file in this directory + -n No php.ini file will be used -d foo[=bar] Define INI entry foo with value 'bar' -e Generate extended information for debugger/profiler - -z fileLoad Zend extension file. + -f fileParse file. + -h This help + -i PHP information -l Syntax check only (lint) -m Show compiled in modules - -i PHP information -r codeRun PHP code without using script tags ?..? - -h This help + -B begin_code Run PHP begin_code before processing input lines + -R codeRun PHP code for every input line + -F fileParse and execute file for every input line + -E end_codeRun PHP end_code after processing all input lines + -H Hide any passed arguments from external tools. + -s Display colour syntax highlighted source. + -v Version number + -w Display source with stripped comments and whitespace. + -z fileLoad Zend extension file. - args... Arguments passed to script. Use -- args when first argument + args... Arguments passed to script. Use -- args when first argument starts with - or script is read from stdin ]] /screen @@ -538,75 +547,11 @@ /thead tbody row - entry-s/entry - entry--syntax-highlight/entry - entry - para -Display colour syntax highlighted source. - /para - para -This option uses the internal mechanism to parse the file and produces -a literalHTML/literal highlighted version of it and writes it to -standard output. Note that all it does it to generate a block of -literallt;codegt; [...] lt;/codegt;/literal -literalHTML/literal tags, no literalHTML/literal headers. - /para - note -para - This option does not work together with the option-r/option - option. -/para - /note - /entry - /row - row - entry-s/entry - entry--syntax-highlighting/entry - entry - para -Alias of option--syntax-highlight/option. - /para - /entry - /row - row - entry-w/entry - entry--strip/entry - entry - para -Display source with stripped comments and whitespace. - /para - note -para - This option does not work together with the option-r/option - option. -/para - /note - /entry - /row - row - entry-f/entry - entry--file/entry - entry - para -Parses and executed the given filename to the option-f/option -option. This switch is optional and can be left out. Only providing -the filename to execute is sufficient. - /para - /entry - /row - row - entry-v/entry - entry--version/entry + entry-a/entry + entry--interactive/entry entry para -Writes the PHP, PHP SAPI, and Zend version to standard output, e.g. -screen -![CDATA[ -$ php -v -PHP 4.3.0 (cli), Copyright (c) 1997-2002 The PHP Group -Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies -]] -/screen +Runs PHP interactively. /para /entry /row @@ -680,44 +625,44 @@
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
vrana Thu Oct 28 05:29:35 2004 EDT Modified files: /phpdoc/en/features commandline.xml Log: -C in CGI (bug #30544) http://cvs.php.net/diff.php/phpdoc/en/features/commandline.xml?r1=1.37r2=1.38ty=u Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.37 phpdoc/en/features/commandline.xml:1.38 --- phpdoc/en/features/commandline.xml:1.37 Sun Sep 26 11:06:09 2004 +++ phpdoc/en/features/commandline.xml Thu Oct 28 05:29:33 2004 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.37 $ -- +!-- $Revision: 1.38 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- @@ -342,7 +342,7 @@ /para note para - The literalCGI SAPI/literal supports the literalCLI SAPI/literal + The literalCGI SAPI/literal supports this literalCLI SAPI/literal behaviour by means of the option-C/option switch when run from the command line. /para
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
vrana Tue Jul 27 09:40:02 2004 EDT Modified files: /phpdoc/en/features commandline.xml Log: Example for reading data (bug #21428) http://cvs.php.net/diff.php/phpdoc/en/features/commandline.xml?r1=1.32r2=1.33ty=u Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.32 phpdoc/en/features/commandline.xml:1.33 --- phpdoc/en/features/commandline.xml:1.32 Sat May 22 04:52:07 2004 +++ phpdoc/en/features/commandline.xml Tue Jul 27 09:40:02 2004 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.32 $ -- +!-- $Revision: 1.33 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- @@ -230,6 +230,16 @@ $stdin = fopen('php://stdin', 'r'); +? +]] + /programlisting + If you want to read single line from literalstdin/literal, you can + use + programlisting role=php +![CDATA[ +?php +$line = trim(fgets(STDIN)); // reads one line from STDIN +fscanf(STDIN, %d\n, $number); // reads number from STDIN ? ]] /programlisting
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
vrana Tue Jul 27 12:42:32 2004 EDT Modified files: /phpdoc/en/features commandline.xml Log: Removed old documentation http://cvs.php.net/diff.php/phpdoc/en/features/commandline.xml?r1=1.33r2=1.34ty=u Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.33 phpdoc/en/features/commandline.xml:1.34 --- phpdoc/en/features/commandline.xml:1.33 Tue Jul 27 09:40:02 2004 +++ phpdoc/en/features/commandline.xml Tue Jul 27 12:42:32 2004 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.33 $ -- +!-- $Revision: 1.34 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- @@ -910,149 +910,6 @@ For Windows users both the PHP executable and the server modules are in the binary package, the executable is named filenamephp.exe/filename. - /para - para - This list of command line options is consistent with PHP 4.0.6. - You can get the actual list and some one line descriptions - with the literal-h/literal option. The output of - literalphp -h/literal should be something like this: - screen -![CDATA[ -Usage: php [-q] [-h] [-s [-v] [-i] [-f file] | {file [args...]} - -q Quiet-mode. Suppress HTTP Header output. - -s Display colour syntax highlighted source. - -f file Parse file. Implies `-q' - -v Version number - -C Do not chdir to the script's directory - -c path Look for php.ini file in this directory - -d foo[=bar] Define INI entry foo with value 'bar' - -e Generate extended information for debugger/profiler - -z file Load Zend extension file. - -l Syntax check only (lint) - -m Show compiled in modules - -i PHP information - -h This help -]] - /screen - /para - para - Here we list some of the most important command line options - with detailed explanations. - /para - para - table - titleCommand line options/title - tgroup cols=2 -thead - row - entryOption/entry - entryDescription/entry - /row -/thead -tbody - row - entry-q/entry - entry - Suppress HTTP headers output. Normally PHP prints out - HTTP headers for the calling program (ie. webserver) - to hand on to the browser. When writing command line - applications these headers are useless. - /entry - /row - row - entry-s/entry - entry - Display the color highlighted source of the file - given with its name. This is the same as if you were - printing out the source using the - functionhighlight_file/function function in - a PHP script. - /entry - /row - row - entry-f/entry - entry - Parse the file given, and search for syntactical and - fatal errors. This option implies -q. Use for - debugging purposes. - /entry - /row - row - entry-v/entry - entry - By calling PHP with this option, you can ask - it to print out its version number, ie: 4.0.6. - /entry - /row - row - entry-C/entry - entry - Normally PHP changes the working directory to the - running scripts directory. This makes it possible - for example, to open files in the same directory, - with only specifying the name of the file. If you - would like to disable this directory change, use - this option. - /entry - /row - row - entry-c/entry - entry - Using this option, you can specify an alternative - php.ini; path, so PHP will - search your configurations file in this path - instead of the default one. - /entry - /row - row - entry-d/entry - entry - With this option, you can set individual - php.ini; settings in the - time of running a script. - /entry - /row - row - entry-l/entry - entry - Check the file given for syntax errors. This - option implies -q. Use for debugging purposes. - This option won't find fatal errors (like undefined - functions). Use -f if you would like to test - for fatal errors too. - /entry - /row - row - entry-m/entry - entry - Using this option, PHP prints out the built in - (and loaded) PHP and Zend modules, the PHP - and Zend version numbers, and a short Zend - copyright notice. - /entry - /row - row - entry-i/entry - entry - This command line option calls - functionphpinfo/function, and prints - out the results. If PHP is not working well, - it is advisable to make a literalphp -i/literal - and see if any error messages are printed out - before or in place of the information tables. - /entry - /row - row - entry-h/entry - entry - With this option,
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
vrana Tue Jul 27 12:46:28 2004 EDT Modified files: /phpdoc/en/features commandline.xml Log: Reference to default locations of php.ini http://cvs.php.net/diff.php/phpdoc/en/features/commandline.xml?r1=1.34r2=1.35ty=u Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.34 phpdoc/en/features/commandline.xml:1.35 --- phpdoc/en/features/commandline.xml:1.34 Tue Jul 27 12:42:32 2004 +++ phpdoc/en/features/commandline.xml Tue Jul 27 12:46:28 2004 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.34 $ -- +!-- $Revision: 1.35 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- @@ -624,6 +624,8 @@ $ php -c /custom/directory/custom-file.ini my_script.php ]] /screen +If you don't specify this option, file is searched in +link linkend=configuration.filedefault locations/link. /para /entry /row
Re: [PHP-DOC] cvs: phpdoc /en/features commandline.xml
What it you update it instead? Or is there another place in the manual, where actual info is available on this? Goba Jakub Vrana rta: vrana Tue Jul 27 12:42:32 2004 EDT Modified files: /phpdoc/en/features commandline.xml Log: Removed old documentation http://cvs.php.net/diff.php/phpdoc/en/features/commandline.xml?r1=1.33r2=1.34ty=u Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.33 phpdoc/en/features/commandline.xml:1.34 --- phpdoc/en/features/commandline.xml:1.33 Tue Jul 27 09:40:02 2004 +++ phpdoc/en/features/commandline.xml Tue Jul 27 12:42:32 2004 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.33 $ -- +!-- $Revision: 1.34 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- @@ -910,149 +910,6 @@ For Windows users both the PHP executable and the server modules are in the binary package, the executable is named filenamephp.exe/filename. - /para - para - This list of command line options is consistent with PHP 4.0.6. - You can get the actual list and some one line descriptions - with the literal-h/literal option. The output of - literalphp -h/literal should be something like this: - screen -![CDATA[ -Usage: php [-q] [-h] [-s [-v] [-i] [-f file] | {file [args...]} - -q Quiet-mode. Suppress HTTP Header output. - -s Display colour syntax highlighted source. - -f file Parse file. Implies `-q' - -v Version number - -C Do not chdir to the script's directory - -c path Look for php.ini file in this directory - -d foo[=bar] Define INI entry foo with value 'bar' - -e Generate extended information for debugger/profiler - -z file Load Zend extension file. - -l Syntax check only (lint) - -m Show compiled in modules - -i PHP information - -h This help -]] - /screen - /para - para - Here we list some of the most important command line options - with detailed explanations. - /para - para - table - titleCommand line options/title - tgroup cols=2 -thead - row - entryOption/entry - entryDescription/entry - /row -/thead -tbody - row - entry-q/entry - entry - Suppress HTTP headers output. Normally PHP prints out - HTTP headers for the calling program (ie. webserver) - to hand on to the browser. When writing command line - applications these headers are useless. - /entry - /row - row - entry-s/entry - entry - Display the color highlighted source of the file - given with its name. This is the same as if you were - printing out the source using the - functionhighlight_file/function function in - a PHP script. - /entry - /row - row - entry-f/entry - entry - Parse the file given, and search for syntactical and - fatal errors. This option implies -q. Use for - debugging purposes. - /entry - /row - row - entry-v/entry - entry - By calling PHP with this option, you can ask - it to print out its version number, ie: 4.0.6. - /entry - /row - row - entry-C/entry - entry - Normally PHP changes the working directory to the - running scripts directory. This makes it possible - for example, to open files in the same directory, - with only specifying the name of the file. If you - would like to disable this directory change, use - this option. - /entry - /row - row - entry-c/entry - entry - Using this option, you can specify an alternative - php.ini; path, so PHP will - search your configurations file in this path - instead of the default one. - /entry - /row - row - entry-d/entry - entry - With this option, you can set individual - php.ini; settings in the - time of running a script. - /entry - /row - row - entry-l/entry - entry - Check the file given for syntax errors. This - option implies -q. Use for debugging purposes. - This option won't find fatal errors (like undefined - functions). Use -f if you would like to test - for fatal errors too. - /entry - /row - row - entry-m/entry - entry - Using this option, PHP prints out the built in - (and loaded) PHP and Zend modules, the PHP - and Zend version numbers, and a short Zend - copyright notice. - /entry - /row - row - entry-i/entry - entry - This command line option calls - functionphpinfo/function, and prints - out the results. If PHP is not working well, - it is advisable to make a literalphp -i/literal - and see if any error messages are printed out - before or in
Re: [PHP-DOC] cvs: phpdoc /en/features commandline.xml
This documentation was commented out. There is already a more up-to-date docs in the begining of the file, so there is no problem in removing these lines. This file needs a review... Maybe I can take a look to it tomorrow. Nuno - Original Message - What it you update it instead? Or is there another place in the manual, where actual info is available on this? Goba Jakub Vrana rta: vrana Tue Jul 27 12:42:32 2004 EDT Modified files: /phpdoc/en/features commandline.xml Log: Removed old documentation
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
nlopess Sat May 22 04:52:07 2004 EDT Modified files: /phpdoc/en/features commandline.xml Log: fix -i swith output. Patch by Voytsekhovskyy Alexander http://cvs.php.net/diff.php/phpdoc/en/features/commandline.xml?r1=1.31r2=1.32ty=u Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.31 phpdoc/en/features/commandline.xml:1.32 --- phpdoc/en/features/commandline.xml:1.31 Sun Mar 21 12:00:21 2004 +++ phpdoc/en/features/commandline.xml Sat May 22 04:52:07 2004 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.31 $ -- +!-- $Revision: 1.32 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- @@ -769,8 +769,8 @@ out the results. If literalPHP/literal is not working correctly, it is advisable to use literalphp -i/literal and see whether any error messages are printed out before or in place of the information tables. - Beware that the output is in literalHTML/literal and therefore - quite huge. + Beware that when using the CGI mode the output is in literalHTML/literal + and therefore quite huge. /entry /row row
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
didou Sun Mar 21 12:00:21 2004 EDT Modified files: /phpdoc/en/features commandline.xml Log: adding php tags, CDATAs, CS and corrected a role http://cvs.php.net/diff.php/phpdoc/en/features/commandline.xml?r1=1.30r2=1.31ty=u Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.30 phpdoc/en/features/commandline.xml:1.31 --- phpdoc/en/features/commandline.xml:1.30 Fri Feb 6 12:17:52 2004 +++ phpdoc/en/features/commandline.xml Sun Mar 21 12:00:21 2004 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.30 $ -- +!-- $Revision: 1.31 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- @@ -226,7 +226,11 @@ opening it with programlisting role=php ![CDATA[ +?php + $stdin = fopen('php://stdin', 'r'); + +? ]] /programlisting /entry @@ -238,7 +242,11 @@ opening it with programlisting role=php ![CDATA[ +?php + $stdout = fopen('php://stdout', 'w'); + +? ]] /programlisting /entry @@ -250,7 +258,11 @@ opening it with programlisting role=php ![CDATA[ +?php + $stderr = fopen('php://stderr', 'w'); + +? ]] /programlisting /entry @@ -263,7 +275,7 @@ Given the above, you don't need to open e.g. a stream for literalstderr/literal yourself but simply use the constant instead of the stream resource: - programlisting role=php + programlisting role=shell ![CDATA[ php -r 'fwrite(STDERR, stderr\n);' ]] @@ -283,8 +295,8 @@ programlisting role=php ![CDATA[ ?php -/* Our simple test application named test.php*/ -echo getcwd(), \n; +// Our simple test application named test.php +echo getcwd(), \n; ? ]] /programlisting @@ -476,7 +488,7 @@ ![CDATA[ #!/usr/bin/php ?php -var_dump($argv); +var_dump($argv); ? ]] /programlisting @@ -1101,7 +1113,9 @@ example titleBatch file to run a command line PHP script (script.bat)/title programlisting role=shell +![CDATA[ @c:\php\cli\php.exe script.php %1 %2 %3 %4 +]] /programlisting /example /para
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
nlopess Fri Feb 6 12:17:52 2004 EDT Modified files: /phpdoc/en/features commandline.xml Log: php-win is just for PHP5 http://cvs.php.net/diff.php/phpdoc/en/features/commandline.xml?r1=1.29r2=1.30ty=u Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.29 phpdoc/en/features/commandline.xml:1.30 --- phpdoc/en/features/commandline.xml:1.29 Fri Jan 16 12:40:32 2004 +++ phpdoc/en/features/commandline.xml Fri Feb 6 12:17:52 2004 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.29 $ -- +!-- $Revision: 1.30 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- @@ -65,7 +65,7 @@ filenamephp-cgi.exe/filename. /para para - As of PHP 4.3.5, a new filenamephp-win.exe/filename file is distributed. + As of PHP 5, a new filenamephp-win.exe/filename file is distributed. This is equal to the CLI version, except that php-win doesn't output anything and thus provides no console (no dos box appears on the screen). This behavior is similar to php-gtk. You should configure with
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
nlopess Fri Jan 16 11:43:55 2004 EDT Modified files: /phpdoc/en/features commandline.xml Log: added differences in CLI and CGI versions in PHP 5 Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.27 phpdoc/en/features/commandline.xml:1.28 --- phpdoc/en/features/commandline.xml:1.27 Wed Jan 14 14:42:54 2004 +++ phpdoc/en/features/commandline.xml Fri Jan 16 11:43:54 2004 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.27 $ -- +!-- $Revision: 1.28 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- @@ -59,13 +59,17 @@ filenamephp-cli.exe/filename, living in the same folder as the CGI filenamephp.exe/filename. Starting with PHP 4.3.0 the windows package distributes the CLI as filenamephp.exe/filename in a separate folder - named literalcli/literal, so literalcli/php.exe/literal. + named literalcli/literal, so literalcli/php.exe/literal. + Starting with PHP 5, the CLI is distributed in the main folder, named + filenamephp.exe/filename. The CGI version is distributed as + filenamephp-cgi.exe/filename. /para para - As of PHP 4.3.5, a new php-win.exe file is distributed. This is equal to the - CLI version, except that php-win doesn't output anything and thus as no - console (no dos box appears on the screen). This method is similar with - php-gtk. + As of PHP 4.3.5, a new filenamephp-win.exe/filename file is distributed. + This is equal to the CLI version, except that php-win doesn't output + anything and thus as no console (no dos box appears on the screen). This + method is similar with php-gtk. You should configure with + literal--enable-cli-win32/literal. /para para note
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
kennyt Fri Jan 16 12:40:32 2004 EDT Modified files: /phpdoc/en/features commandline.xml Log: as = provides (or has, w/e) Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.28 phpdoc/en/features/commandline.xml:1.29 --- phpdoc/en/features/commandline.xml:1.28 Fri Jan 16 11:43:54 2004 +++ phpdoc/en/features/commandline.xml Fri Jan 16 12:40:32 2004 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.28 $ -- +!-- $Revision: 1.29 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- @@ -67,8 +67,8 @@ para As of PHP 4.3.5, a new filenamephp-win.exe/filename file is distributed. This is equal to the CLI version, except that php-win doesn't output - anything and thus as no console (no dos box appears on the screen). This - method is similar with php-gtk. You should configure with + anything and thus provides no console (no dos box appears on the screen). This + behavior is similar to php-gtk. You should configure with literal--enable-cli-win32/literal. /para para
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
nlopess Wed Jan 14 14:42:54 2004 EDT Modified files: /phpdoc/en/features commandline.xml Log: added reference to php-win.exe Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.26 phpdoc/en/features/commandline.xml:1.27 --- phpdoc/en/features/commandline.xml:1.26 Sat Dec 20 23:21:41 2003 +++ phpdoc/en/features/commandline.xml Wed Jan 14 14:42:54 2004 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.26 $ -- +!-- $Revision: 1.27 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- @@ -62,6 +62,12 @@ named literalcli/literal, so literalcli/php.exe/literal. /para para + As of PHP 4.3.5, a new php-win.exe file is distributed. This is equal to the + CLI version, except that php-win doesn't output anything and thus as no + console (no dos box appears on the screen). This method is similar with + php-gtk. + /para + para note titleWhat SAPI do I have?/title para
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
vrana Mon Dec 15 12:39:25 2003 EDT Modified files: /phpdoc/en/features commandline.xml Log: Long options added Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.23 phpdoc/en/features/commandline.xml:1.24 --- phpdoc/en/features/commandline.xml:1.23 Wed Jun 18 06:38:43 2003 +++ phpdoc/en/features/commandline.xml Mon Dec 15 12:39:25 2003 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.23 $ -- +!-- $Revision: 1.24 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- @@ -96,11 +96,11 @@ /para para CLI is started up in quiet mode by default, though the literal-q/literal - switch is kept for compatibility so that you can use older CGI scripts. + and literal--no-header/literal switches are kept for compatibility so that you can use older CGI scripts. /para para It does not change the working directory to that of the script. - (literal-C/literal switch kept for compatibility) + (literal-C/literal and literal--no-chdir/literal switches kept for compatibility) /para para Plain text error messages (no HTML formatting). @@ -108,12 +108,12 @@ /listitem listitem para - There are certain php.ini; directives which are overriden by the literalCLI + There are certain php.ini; directives which are overridden by the literalCLI SAPI/literal because they do not make sense in shell environments: /para para table - titleOverriden php.ini; directives/title + titleOverridden php.ini; directives/title tgroup cols=3 thead row @@ -492,18 +492,21 @@ which start with literal-/literal to your script. /para para + Long options are available since PHP 4.3.3. table titleCommand line options/title tgroup cols=2 thead row entryOption/entry + entryLong Option/entry entryDescription/entry /row /thead tbody row entry-s/entry + entry--syntax-highlight/entry entry para Display colour syntax highlighted source. @@ -524,7 +527,17 @@ /entry /row row + entry-s/entry + entry--syntax-highlighting/entry + entry + para +Alias of literal--syntax-highlight/literal. + /para + /entry + /row + row entry-w/entry + entry--strip/entry entry para Display source with stripped comments and whitespace. @@ -539,6 +552,7 @@ /row row entry-f/entry + entry--file/entry entry para Parses and executed the given filename to the literal-f/literal @@ -549,6 +563,7 @@ /row row entry-v/entry + entry--version/entry entry para Writes the PHP, PHP SAPI, and Zend version to standard output, e.g. @@ -564,6 +579,7 @@ /row row entry-c/entry + entry--php-ini/entry entry para With this option one can either specify a directory where to look for @@ -580,19 +596,17 @@ /entry /row row - entry-a/entry + entry-n/entry + entry--no-php-ini/entry entry para -Runs PHP interactively. -!-- -mfischer, 20020510: Couldn't come up with a decent useful description -of the current implementation of the interactive mode. --- +Ignore php.ini at all. This switch is available since PHP 4.3.0. /para /entry /row row entry-d/entry + entry--define/entry entry para This option allows you to set a custom value for any of the configuration @@ -631,7 +645,21 @@ /entry /row row + entry-a/entry + entry--interactive/entry + entry + para +Runs PHP interactively. +!-- +mfischer, 20020510: Couldn't come up with a decent useful description +of the current implementation of the interactive mode. +-- + /para + /entry + /row + row entry-e/entry + entry--profile-info/entry entry para Generate extended information for debugger/profiler. @@ -644,6 +672,7 @@ /row row entry-z/entry + entry--zend-extension/entry entry para Load Zend extension. If only a filename is given, PHP tries to load @@ -658,10 +687,11 @@ /row row entry-l/entry + entry--syntax-check/entry entry para This option provides a convenient way to only perform a syntax check -on the given literalPHP/literal code. On succes, the text +on the given literalPHP/literal code. On success, the text literalNo syntax errors detected in lt;filenamegt;/literal is written to standard output and the shell
[PHP-DOC] cvs: phpdoc /en/features commandline.xml cookies.xml
derick Wed Jun 18 06:38:43 2003 EDT Modified files: /phpdoc/en/features commandline.xml cookies.xml Log: - Some structuring Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.22 phpdoc/en/features/commandline.xml:1.23 --- phpdoc/en/features/commandline.xml:1.22 Wed Jun 11 11:25:26 2003 +++ phpdoc/en/features/commandline.xml Wed Jun 18 06:38:43 2003 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.22 $ -- +!-- $Revision: 1.23 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- @@ -43,37 +43,43 @@ install/literal. Alternatively you can specify literal--disable-cgi /literal in your configure line. /para - note - para - Because both literal--enable-cli/literal and literal - --enable-cgi/literal are enabled by default, simply having - literal--enable-cli/literal in your configure line does - not necessarily mean the CLI will be copied as literal - {PREFIX}/bin/php/literal during literalmake install/literal. - /para - /note + para + note + para +Because both literal--enable-cli/literal and literal +--enable-cgi/literal are enabled by default, simply having +literal--enable-cli/literal in your configure line does +not necessarily mean the CLI will be copied as literal +{PREFIX}/bin/php/literal during literalmake install/literal. + /para + /note + /para para The windows packages between PHP 4.2.0 and PHP 4.2.3 distributed the CLI as - filenamephp-cli.exe/filename,living in the same folder as the CGI + filenamephp-cli.exe/filename, living in the same folder as the CGI filenamephp.exe/filename. Starting with PHP 4.3.0 the windows package - distributes the CLI as filenamephp.exe/filename in a separate folder named cli, - so literalcli/php.exe/literal. + distributes the CLI as filenamephp.exe/filename in a separate folder + named literalcli/literal, so literalcli/php.exe/literal. + /para + para + note + titleWhat SAPI do I have?/title + para +From a shell, typing literalphp -v/literal will tell you +whether literalphp/literal is CGI or CLI. See also the function +functionphp_sapi_name/function and the constant constant +PHP_SAPI/constant. + /para + /note + /para + para + note + para +A unix literalman/literalual page was added in PHP 4.3.2. You may +view this by typing literalman php/literal in your shell environment. + /para + /note /para - note - titleWhat SAPI do I have?/title - para - From a shell, typing literalphp -v/literal will tell you - whether literalphp/literal is CGI or CLI. See also the function - functionphp_sapi_name/function and the constant constant - PHP_SAPI/constant. - /para - /note - note - para - A unix literalman/literalual page was added in PHP 4.3.2. You may - view this by typing literalman php/literal in your shell environment. - /para - /note para Remarkable differences of the literalCLI SAPI/literal compared to other literalSAPI/literals: @@ -104,6 +110,8 @@ para There are certain php.ini; directives which are overriden by the literalCLI SAPI/literal because they do not make sense in shell environments: +/para +para table titleOverriden php.ini; directives/title tgroup cols=3 @@ -427,7 +435,8 @@ literalPHP/literal, every argument following it is passed untouched to your script. /para - screen + para + screen ![CDATA[ # This will not execute the given code but will show the PHP usage $ php -r 'var_dump($argv);' -h @@ -443,7 +452,8 @@ string(2) -h } ]] - /screen + /screen + /para para However, there's another way of using literalPHP/literal for shell scripting. You can write a script where the first line starts with @@ -973,9 +983,10 @@ hurt on Windows, so you can write cross platform programs this way. A simple example of writing a command line PHP program can be found below. /para - example - titleScript intended to be run from command line (script.php)/title - programlisting role=php + para + example + titleScript intended to be run from command line (script.php)/title + programlisting role=php ![CDATA[ #!/usr/bin/php ?php @@ -998,8 +1009,9 @@ } ? ]] - /programlisting - /example + /programlisting + /example + /para para In the script above, we used the special first line to indicate that this file should be run by PHP. We work with a CLI version @@ -1024,12 +1036,14 @@ literalscript.php -h/literal. On Windows, you can make a batch file for this task: /para - example - titleBatch file to run a command line PHP script (script.bat)/title - programlisting role=winbat + para + example + titleBatch file to run a command line PHP script (script.bat)/title + programlisting role=shell @c:\php\cli\php.exe script.php %1 %2 %3 %4 - /programlisting - /example + /programlisting +
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
derick Wed Jun 11 11:25:26 2003 EDT Modified files: /phpdoc/en/features commandline.xml Log: - Fix layout Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.21 phpdoc/en/features/commandline.xml:1.22 --- phpdoc/en/features/commandline.xml:1.21 Wed May 14 03:05:21 2003 +++ phpdoc/en/features/commandline.xml Wed Jun 11 11:25:26 2003 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.21 $ -- +!-- $Revision: 1.22 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- @@ -594,21 +594,26 @@ /screen /para para -Examples: +Examples (lines are wrapped for layout reasons): screen ![CDATA[ # Omitting the value part will set the given configuration directive to 1 -$ php -d max_execution_time -r '$foo = ini_get(max_execution_time); var_dump($foo);' +$ php -d max_execution_time +-r '$foo = ini_get(max_execution_time); var_dump($foo);' string(1) 1 # Passing an empty value part will set the configuration directive to -php -d max_execution_time= -r '$foo = ini_get(max_execution_time); var_dump($foo);' +php -d max_execution_time= +-r '$foo = ini_get(max_execution_time); var_dump($foo);' string(0) # The configuration directive will be set to anything passed after the '=' character -$ php -d max_execution_time=20 -r '$foo = ini_get(max_execution_time); var_dump($foo);' +$ php -d max_execution_time=20 +-r '$foo = ini_get(max_execution_time); var_dump($foo);' string(2) 20 -$ php -d max_execution_time=doesntmakesense -r '$foo = ini_get(max_execution_time); var_dump($foo);' +$ php +-d max_execution_time=doesntmakesense +-r '$foo = ini_get(max_execution_time); var_dump($foo);' string(15) doesntmakesense ]] /screen -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DOC] cvs: phpdoc /en/features commandline.xml cookies.xml http-auth.xml persistent-connections.xml remote-files.xml
damsTue Feb 4 08:05:07 2003 EDT Modified files: /phpdoc/en/features commandline.xml cookies.xml http-auth.xml persistent-connections.xml remote-files.xml Log: php.ini, safemode entities, plus some cdata Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.19 phpdoc/en/features/commandline.xml:1.20 --- phpdoc/en/features/commandline.xml:1.19 Sat Feb 1 08:32:56 2003 +++ phpdoc/en/features/commandline.xml Tue Feb 4 08:05:06 2003 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.19 $ -- +!-- $Revision: 1.20 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- @@ -151,8 +151,8 @@ arguments) in the literalCLI SAPI/literal. /para para - As of PHP 4.3.0, the literalPHP/literal variables literal$argc/literal - and literal$argv/literal are registered and filled in with the appropriate + As of PHP 4.3.0, the literalPHP/literal variables +varname$argc/varname + and varname$argv/varname are registered and filled in with the +appropriate values when using the literalCLI SAPI/literal. Prior to this version, the creation of these variables behaved as they do in literalCGI/literal and literalMODULE/literal versions @@ -201,7 +201,9 @@ An already opened stream to literalstdin/literal. This saves opening it with programlisting role=php +![CDATA[ $stdin = fopen('php://stdin', 'r'); +]] /programlisting /entry /row @@ -211,7 +213,9 @@ An already opened stream to literalstdout/literal. This saves opening it with programlisting role=php +![CDATA[ $stdout = fopen('php://stdout', 'w'); +]] /programlisting /entry /row @@ -221,7 +225,9 @@ An already opened stream to literalstderr/literal. This saves opening it with programlisting role=php +![CDATA[ $stderr = fopen('php://stderr', 'w'); +]] /programlisting /entry /row @@ -234,7 +240,9 @@ literalstderr/literal yourself but simply use the constant instead of the stream resource: programlisting role=php +![CDATA[ php -r 'fwrite(STDERR, stderr\n);' +]] /programlisting You do not need to explicitly close these streams, as they are closed automatically by literalPHP/literal when your script ends. Index: phpdoc/en/features/cookies.xml diff -u phpdoc/en/features/cookies.xml:1.13 phpdoc/en/features/cookies.xml:1.14 --- phpdoc/en/features/cookies.xml:1.13 Sat Dec 22 11:01:52 2001 +++ phpdoc/en/features/cookies.xml Tue Feb 4 08:05:06 2003 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.13 $ -- +!-- $Revision: 1.14 $ -- chapter id=features.cookies titleCookies/title @@ -25,9 +25,9 @@ /para para - In PHP 4.1.0 and later, the literal$_COOKIE/literal auto-global + In PHP 4.1.0 and later, the varname$_COOKIE/varname auto-global array will always be set with any cookies sent from the client. - literal$HTTP_COOKIE_VARS/literal is also set in earlier versions of PHP + varname$HTTP_COOKIE_VARS/varname is also set in earlier versions of PHP when the literaltrack_vars/literal configuration variable is set. /para Index: phpdoc/en/features/http-auth.xml diff -u phpdoc/en/features/http-auth.xml:1.31 phpdoc/en/features/http-auth.xml:1.32 --- phpdoc/en/features/http-auth.xml:1.31 Sun Jan 19 04:46:52 2003 +++ phpdoc/en/features/http-auth.xmlTue Feb 4 08:05:06 2003 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.31 $ -- +!-- $Revision: 1.32 $ -- chapter id=features.http-auth titleHTTP authentication with PHP/title @@ -88,8 +88,8 @@ reveals the password for a page that was authenticated through a traditional external mechanism, the PHP_AUTH variables will not be set if external authentication is enabled for that particular - page and link linkend=features.safe-modesafe mode/link is - enabled. Regardless, varnameREMOTE_USER/varname can be used + page and safemode; is enabled. Regardless, + varnameREMOTE_USER/varname can be used to identify the externally-authenticated user. So, you can use varname$_SERVER['REMOTE_USER']/varname. /simpara Index: phpdoc/en/features/persistent-connections.xml diff -u phpdoc/en/features/persistent-connections.xml:1.20 phpdoc/en/features/persistent-connections.xml:1.21 --- phpdoc/en/features/persistent-connections.xml:1.20 Mon Nov 11 21:56:19 2002 +++ phpdoc/en/features/persistent-connections.xml Tue Feb 4 08:05:06 2003 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.20 $ -- +!-- $Revision: 1.21 $ -- chapter id=features.persistent-connections titlePersistent Database Connections/title @@
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
betzSat Feb 1 08:32:57 2003 EDT Modified files: /phpdoc/en/features commandline.xml Log: naming issues for cli and cgi for win documented\nfix for bug #20888 Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.18 phpdoc/en/features/commandline.xml:1.19 --- phpdoc/en/features/commandline.xml:1.18 Sat Jan 18 18:55:53 2003 +++ phpdoc/en/features/commandline.xml Sat Feb 1 08:32:56 2003 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.18 $ -- +!-- $Revision: 1.19 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- @@ -53,8 +53,11 @@ /para /note para - The windows package distributes the CGI as php.exe and has a folder named - cli with the CLI in it, so: literalcli/php.exe/literal. + The windows packages between PHP 4.2.0 and PHP 4.2.3 distributed the CLI as + filenamephp-cli.exe/filename,living in the same folder as the CGI + filenamephp.exe/filename. Starting with PHP 4.3.0 the windows package + distributes the CLI as filenamephp.exe/filename in a separate folder named cli, + so literalcli/php.exe/literal. /para note titleWhat SAPI do I have?/title -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
philip Thu Jan 16 02:11:25 2003 EDT Modified files: /phpdoc/en/features commandline.xml Log: -r is available in CLI, not CGI. Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.16 phpdoc/en/features/commandline.xml:1.17 --- phpdoc/en/features/commandline.xml:1.16 Sat Dec 28 06:09:30 2002 +++ phpdoc/en/features/commandline.xml Thu Jan 16 02:11:24 2003 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.16 $ -- +!-- $Revision: 1.17 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- @@ -747,6 +747,12 @@ One can still easily run into troubles when trying to get shell variables into the code or using backslashes for escaping. You've been warned. !-- :-) -- +/para + /note + note +para + literal-r/literal is available in the emphasisCLI/emphasis + SAPI and not in the emphasisCGI/emphasis SAPI. /para /note /entry -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
david Sat Dec 28 06:09:30 2002 EDT Modified files: /phpdoc/en/features commandline.xml Log: fix some typos/clarification Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.15 phpdoc/en/features/commandline.xml:1.16 --- phpdoc/en/features/commandline.xml:1.15 Fri Dec 27 19:42:31 2002 +++ phpdoc/en/features/commandline.xml Sat Dec 28 06:09:30 2002 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.15 $ -- +!-- $Revision: 1.16 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- @@ -11,7 +11,7 @@ main focus is on developing shell (or desktop as well) applications with literalPHP/literal. There are quite a few differences between the literalCLI SAPI/literal and other literalSAPI/literals which are - further explained throughout this chapter. It's worth mentioning + explained in this chapter. It's worth mentioning that literalCLI/literal and literalCGI/literal are different SAPI's although they do share many of the same behaviors. /para @@ -59,7 +59,7 @@ note titleWhat SAPI do I have?/title para - While in shell, by typing literalphp -v/literal it will tell you + From a shell, typing literalphp -v/literal will tell you whether literalphp/literal is CGI or CLI. See also the function functionphp_sapi_name/function and the constant constant PHP_SAPI/constant. @@ -75,25 +75,25 @@ output. /para para - Though the literalCGI SAPI/literal provies a way to suppress HTTP - headers, there's not equivalent switch to enable them in the literalCLI + Though the literalCGI SAPI/literal provides a way to suppress HTTP + headers, there's no equivalent switch to enable them in the literalCLI SAPI/literal. /para para - CLI is started up in quiet mode by default. But literal-q/literal - switch is kept for compatibility so that you can use older CGI scripts. + CLI is started up in quiet mode by default, though the literal-q/literal + switch is kept for compatibility so that you can use older CGI scripts. /para para - It does not change the working directory to that of the script. - (literal-C/literal switch kept for compatibility) + It does not change the working directory to that of the script. + (literal-C/literal switch kept for compatibility) /para para - Plain text error messages (no HTML formatting). + Plain text error messages (no HTML formatting). /para /listitem listitem para - The are certain php.ini; directives which are overriden by the literalCLI + There are certain php.ini; directives which are overriden by the literalCLI SAPI/literal because they do not make sense in shell environments: table titleOverriden php.ini; directives/title @@ -121,7 +121,7 @@ entry It is desired that any output coming from functionprint/function, functionecho/function and friends is - immidiately written to the output and not cached in any buffer. You + immediately written to the output and not cached in any buffer. You still can use link linkend=ref.outcontroloutput buffering/link if you want to defer or manipulate standard output. /entry @@ -132,8 +132,8 @@ entry Due to endless possibilities of using literalPHP/literal in shell environments, the maximum execution time has been set to - unlimited. Whereas applications written for the web are executed - within splits of a seconds, shell application tend to have a much + unlimited. Whereas applications written for the web are often + executed very quickly, shell application tend to have a much longer execution time. /entry /row @@ -150,13 +150,13 @@ para As of PHP 4.3.0, the literalPHP/literal variables literal$argc/literal and literal$argv/literal are registered and filled in with the appropriate - values when using the literalCLI SAPI/literal. Before this time + values when using the literalCLI SAPI/literal. Prior to this version, the creation of these variables behaved as they do in literalCGI/literal and literalMODULE/literal versions which requires the PHP directive link linkend=ini.register-globalsregister_globals/link to be emphasison/emphasis. Regardless of version or register_globals - setting you can always go through either + setting, you can always go through either link linkend=reserved.variables.server$_SERVER/link or varname$HTTP_SERVER_VARS/varname. Example: varname$_SERVER['argv']/varname @@ -169,7 +169,7 @@ /para note para - These
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
philip Fri Dec 27 19:41:00 2002 EDT Modified files: /phpdoc/en/features commandline.xml Log: Typos. Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.13 phpdoc/en/features/commandline.xml:1.14 --- phpdoc/en/features/commandline.xml:1.13 Wed Dec 25 04:14:54 2002 +++ phpdoc/en/features/commandline.xml Fri Dec 27 19:41:00 2002 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.13 $ -- +!-- $Revision: 1.14 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- @@ -18,7 +18,7 @@ para The literalCLI SAPI/literal was released for the first time with literalPHP 4.2.0/literal, but was still experimental and had - to be explicitely enabled with literal--enable-cli/literal when running + to be explicitly enabled with literal--enable-cli/literal when running literal./configure/literal. Since literalPHP 4.3.0/literal the literalCLI SAPI/literal is no longer experimental and the option literal--enable-cli/literal is on by default. You may use @@ -28,7 +28,7 @@ As of PHP 4.3.0, the name, location and existence of the CLI/CGI binaries will differ depending on how PHP is installed on your system. By default when executing literalmake/literal, both the CGI and CLI are built and - placed as literalsapi/cgi/php/literal and literalsapi/cgi/php/literal + placed as literalsapi/cgi/php/literal and literalsapi/cli/php/literal respectfully, in your php source directory. You will note that both are named literalphp/literal. What happens during literalmake install/literal depends on your configure -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
philip Fri Dec 27 19:42:31 2002 EDT Modified files: /phpdoc/en/features commandline.xml Log: *sigh* typo. Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.14 phpdoc/en/features/commandline.xml:1.15 --- phpdoc/en/features/commandline.xml:1.14 Fri Dec 27 19:41:00 2002 +++ phpdoc/en/features/commandline.xml Fri Dec 27 19:42:31 2002 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.14 $ -- +!-- $Revision: 1.15 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- @@ -29,7 +29,7 @@ will differ depending on how PHP is installed on your system. By default when executing literalmake/literal, both the CGI and CLI are built and placed as literalsapi/cgi/php/literal and literalsapi/cli/php/literal - respectfully, in your php source directory. You will note that both are + respectively, in your php source directory. You will note that both are named literalphp/literal. What happens during literalmake install/literal depends on your configure line. If a module SAPI is chosen during configure, such as apxs, or the -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
philip Wed Dec 25 04:14:55 2002 EDT Modified files: /phpdoc/en/features commandline.xml Log: Began the process of documenting CLI and CGI as of PHP 4.3.0. Includes various tidbits of information including how to compile, what the binaries may be named, etc. Also updated the examples to reflect current behavior. Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.12 phpdoc/en/features/commandline.xml:1.13 --- phpdoc/en/features/commandline.xml:1.12 Thu Nov 14 06:22:58 2002 +++ phpdoc/en/features/commandline.xml Wed Dec 25 04:14:54 2002 @@ -1,28 +1,70 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.12 $ -- +!-- $Revision: 1.13 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- para - As of version 4.3, literalPHP/literal supports a new + As of version 4.3.0, literalPHP/literal supports a new literalSAPI/literal type (Server Application Programming Interface) named literalCLI/literal which means emphasisCommand Line Interface/emphasis. As the name implies, this literalSAPI/literal type main focus is on developing shell (or desktop as well) applications with - literalPHP/literal. There are quite some differences between the + literalPHP/literal. There are quite a few differences between the literalCLI SAPI/literal and other literalSAPI/literals which are - further explained throughout this chapter. + further explained throughout this chapter. It's worth mentioning + that literalCLI/literal and literalCGI/literal are different + SAPI's although they do share many of the same behaviors. /para para The literalCLI SAPI/literal was released for the first time with - literalPHP 4.2.0/literal, but was still experimental back then and had + literalPHP 4.2.0/literal, but was still experimental and had to be explicitely enabled with literal--enable-cli/literal when running - literal./configure/literal. Since literalPHP 4.3.0/literal the - literalCLI SAPI/literal is no longer experimental and is therefore - emphasis role=strongalways/emphasis built and installed as the - filenamephp/filename (called filenamephp.exe/filename on Windows) - binary. - /para + literal./configure/literal. Since literalPHP 4.3.0/literal the + literalCLI SAPI/literal is no longer experimental and the option + literal--enable-cli/literal is on by default. You may use + literal--disable-cli/literal to disable it. + /para + para + As of PHP 4.3.0, the name, location and existence of the CLI/CGI binaries + will differ depending on how PHP is installed on your system. By default + when executing literalmake/literal, both the CGI and CLI are built and + placed as literalsapi/cgi/php/literal and literalsapi/cgi/php/literal + respectfully, in your php source directory. You will note that both are + named literalphp/literal. What happens during literalmake + install/literal depends on your configure + line. If a module SAPI is chosen during configure, such as apxs, or the + literal --disable-cgi/literal option is used, the CLI is copied to + literal{PREFIX}/bin/php/literal during literalmake install/literal + otherwise the CGI is placed there. So, for example, if literal--with--apxs + /literal is in your configure line then the CLI is copied to + literal{PREFIX}/bin/php/literal during literalmake + install/literal. If you want to override the installation of the CGI + binary, use literalmake install-cli/literal after literalmake + install/literal. Alternatively you can specify literal--disable-cgi + /literal in your configure line. + /para + note + para + Because both literal--enable-cli/literal and literal + --enable-cgi/literal are enabled by default, simply having + literal--enable-cli/literal in your configure line does + not necessarily mean the CLI will be copied as literal + {PREFIX}/bin/php/literal during literalmake install/literal. + /para + /note + para + The windows package distributes the CGI as php.exe and has a folder named + cli with the CLI in it, so: literalcli/php.exe/literal. + /para + note + titleWhat SAPI do I have?/title + para + While in shell, by typing literalphp -v/literal it will tell you + whether literalphp/literal is CGI or CLI. See also the function + functionphp_sapi_name/function and the constant constant + PHP_SAPI/constant. + /para + /note para Remarkable differences of the literalCLI SAPI/literal compared to other literalSAPI/literals: @@ -199,27 +241,27 @@ para The literalCLI SAPI/literal does emphasis role=strongnot/emphasis change the current directory to the directory - of the executed script ! + of the executed script! /para para Example showing the difference to the literalCGI SAPI/literal: programlisting role=php ![CDATA[ ?php -/* Our simple test application */ +/* Our simple test
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
philip Thu Nov 14 06:22:58 2002 EDT Modified files: /phpdoc/en/features commandline.xml Log: $argv and $argc only exist if register_globals = on in CLI before 4.3.0 Closes bug #20411 Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.11 phpdoc/en/features/commandline.xml:1.12 --- phpdoc/en/features/commandline.xml:1.11 Fri Aug 16 12:13:18 2002 +++ phpdoc/en/features/commandline.xml Thu Nov 14 06:22:58 2002 -1,5 +1,5 ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.11 $ -- +!-- $Revision: 1.12 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- -99,11 +99,26 entrylink linkend=ini.register-argc-argvregister_argc_argv/link/entry entrytrue;/entry entry - The global literalPHP/literal variables literal$argc/literal - (number of arguments passed to the application) and - literal$argv/literal (array of the actual arguments) are always - registered and filled in with the appropriate values when using the - literalCLI SAPI/literal. + para + Because this setting is true; you will always have access to + emphasisargc/emphasis (number of arguments passed to the + application) and emphasisargv/emphasis (array of the actual + arguments) in the literalCLI SAPI/literal. + /para + para + As of PHP 4.3.0, the literalPHP/literal variables +literal$argc/literal + and literal$argv/literal are registered and filled in with the +appropriate + values when using the literalCLI SAPI/literal. Before this time + the creation of these variables behaved as they do in + literalCGI/literal and literalMODULE/literal versions + which requires the PHP directive + link linkend=ini.register-globalsregister_globals/link to + be emphasison/emphasis. Regardless of version or register_globals + setting you can always go through either + link linkend=reserved.variables.server$_SERVER/link or + varname$HTTP_SERVER_VARS/varname. Example: + varname$_SERVER['argv']/varname + /para /entry /row /tbody -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
helly Fri Aug 16 12:13:18 2002 EDT Modified files: /phpdoc/en/features commandline.xml Log: some additions Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.10 phpdoc/en/features/commandline.xml:1.11 --- phpdoc/en/features/commandline.xml:1.10 Thu Aug 8 14:21:45 2002 +++ phpdoc/en/features/commandline.xml Fri Aug 16 12:13:18 2002 -1,5 +1,5 ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.10 $ -- +!-- $Revision: 1.11 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- -29,13 +29,24 itemizedlist listitem para - Unlikely the literalCGI SAPI/literal, no headers are written to the + Unlike the literalCGI SAPI/literal, no headers are written to the output. /para para Though the literalCGI SAPI/literal provies a way to suppress HTTP headers, there's not equivalent switch to enable them in the literalCLI SAPI/literal. +/para +para + CLI is started up in quiet mode by default. But literal-q/literal + switch is kept for compatibility so that you can use older CGI scripts. +/para +para + It does not change the working directory to that of the script. + (literal-C/literal switch kept for compatibility) +/para +para + Plain text error messages (no HTML formatting). /para /listitem listitem -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
betzSun Jul 28 08:30:27 2002 EDT Modified files: /phpdoc/en/features commandline.xml Log: typo Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.8 phpdoc/en/features/commandline.xml:1.9 --- phpdoc/en/features/commandline.xml:1.8 Fri Jun 21 08:50:56 2002 +++ phpdoc/en/features/commandline.xml Sun Jul 28 08:30:26 2002 -1,5 +1,5 ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.8 $ -- +!-- $Revision: 1.9 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- -41,7 +41,7 listitem para The are certain php.ini; directives which are overriden by the literalCLI - SAPI/literal because the do not make sense in shell environments: + SAPI/literal because they do not make sense in shell environments: table titleOverriden php.ini; directives/title tgroup cols=3 -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DOC] cvs: phpdoc /en/features commandline.xml file-upload.xml /en/reference/dbplus reference.xml /en/reference/mysql reference.xml /en/reference/mysql/functions mysql-drop-db.xml mysql-insert-id.xml mysql-list-fields.xml mysql-stat.xml mysql-thread-id.xml
derick Fri Jun 21 08:51:05 2002 EDT Modified files: /phpdoc/en/features commandline.xml file-upload.xml /phpdoc/en/reference/dbplus reference.xml /phpdoc/en/reference/mysql reference.xml /phpdoc/en/reference/mysql/functionsmysql-drop-db.xml mysql-insert-id.xml mysql-list-fields.xml mysql-stat.xml mysql-thread-id.xml Log: - fix typoes (found by Paul Hudson [EMAIL PROTECTED]) Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.7 phpdoc/en/features/commandline.xml:1.8 --- phpdoc/en/features/commandline.xml:1.7 Thu Jun 13 06:43:23 2002 +++ phpdoc/en/features/commandline.xml Fri Jun 21 08:50:56 2002 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.7 $ -- +!-- $Revision: 1.8 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- @@ -101,7 +101,7 @@ /para note para - This directives cannot be initialzied with another value from the + These directives cannot be initialzied with another value from the configuration file php.ini; or a custom one (if specified). This is a limitation because those default values are applied after all configuration files have been parsed. However, their value can be changed @@ -112,7 +112,7 @@ /listitem listitem para - The ease the operating in the shell environment, the following constants + To ease working in the shell environment, the following constants are defined: table titleCLI specific Constants/title @@ -165,7 +165,7 @@ programlisting role=php php -r 'fwrite(STDERR, stderr\n);' /programlisting - You do not need to explicitely close these streams, this is automatically + You do not need to explicitly close these streams, this is automatically done by literalPHP/literal. /para /listitem @@ -226,7 +226,7 @@ /para para The list of command line options provided by the literalPHP/literal - binary can be queryied anytime by running literalPHP/literal with the + binary can be queried anytime by running literalPHP/literal with the literal-h/literal switch: screen ![CDATA[ @@ -318,7 +318,7 @@ You cannot combine any of the three ways to execute code. /para para - Like every shell application not only the literalPHP/literal binary + Like every shell application, the literalPHP/literal binary accepts a number of arguments but also your literalPHP/literal script can receive them. The number of arguments which can be passed to your script is not limited by literalPHP/literal (the shell has a certain size limit @@ -361,7 +361,7 @@ /screen para However, there's another way of using literalPHP/literal for shell - scripting. You can write a script which's first line starts with + scripting. You can write a script where the first line starts with literal#!/usr/bin/php/literal and then following the normal literalPHP/literal code included within the literalPHP/literal starting and end tags and set the execution attributes of the file Index: phpdoc/en/features/file-upload.xml diff -u phpdoc/en/features/file-upload.xml:1.39 phpdoc/en/features/file-upload.xml:1.40 --- phpdoc/en/features/file-upload.xml:1.39 Sun Jun 16 03:11:00 2002 +++ phpdoc/en/features/file-upload.xml Fri Jun 21 08:50:56 2002 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.39 $ -- +!-- $Revision: 1.40 $ -- chapter id=features.file-upload titleHandling file uploads/title @@ -43,7 +43,7 @@ para The MAX_FILE_SIZE is advisory to the browser. It is easy to circumvent this maximum. So don't count on it that the browser - obeys you wish! The PHP-settings for maximum-size, however, + obeys your wish! The PHP-settings for maximum-size, however, cannot be fooled. /para /warning Index: phpdoc/en/reference/dbplus/reference.xml diff -u phpdoc/en/reference/dbplus/reference.xml:1.3 phpdoc/en/reference/dbplus/reference.xml:1.4 --- phpdoc/en/reference/dbplus/reference.xml:1.3Tue Apr 23 07:04:40 2002 +++ phpdoc/en/reference/dbplus/reference.xmlFri Jun 21 08:50:57 2002 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.3 $ -- +!-- $Revision: 1.4 $ -- reference id=ref.dbplus titleDB++ Functions/title titleabbrevDB++/titleabbrev @@ -10,11 +10,11 @@ section id=dbplus.intro reftitle.intro; para - db++, made by the german company ulink + db++, made by the German company ulink url=url.dbplus.company;Concept asa/ulink, is a relational database system with high performance and low memory and disk usage in mind. While providing SQL as an
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
jan Thu Jun 13 06:43:24 2002 EDT Modified files: /phpdoc/en/features commandline.xml Log: - s/?/?php/ Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.6 phpdoc/en/features/commandline.xml:1.7 --- phpdoc/en/features/commandline.xml:1.6 Thu Jun 6 14:36:45 2002 +++ phpdoc/en/features/commandline.xml Thu Jun 13 06:43:23 2002 -1,5 +1,5 ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.6 $ -- +!-- $Revision: 1.7 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- -179,7 +179,7 Example showing the difference to the literalCGI SAPI/literal: programlisting role=php ![CDATA[ -? +?php /* Our simple test application */ echo getcwd(), \n; ? -370,7 +370,7 programlisting role=php ![CDATA[ #!/usr/bin/php -? +?php var_dump($argv); ? ]]
Re: [PHP-DOC] cvs: phpdoc /en/features commandline.xml
goba Thu May 16 16:52:42 2002 EDT Modified files: /phpdoc/en/features commandline.xml Log: Correcting CGI/CLI problems in script and windows examples This is not, strictly speaking, a bug since cli will happilly ignore -q and -C options in order to maintain backwards compatibility with cgi. Edin
Re: [PHP-DOC] cvs: phpdoc /en/features commandline.xml
Modified files: /phpdoc/en/features commandline.xml Log: Correcting CGI/CLI problems in script and windows examples This is not, strictly speaking, a bug since cli will happilly ignore -q and -C options in order to maintain backwards compatibility with cgi. But -q was not documented on that page, and it is even not printed out as a useable option by -h... Goba
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
mfischerTue May 14 05:06:28 2002 EDT Modified files: /phpdoc/en/features commandline.xml Log: - Minor improvements. Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.3 phpdoc/en/features/commandline.xml:1.4 --- phpdoc/en/features/commandline.xml:1.3 Fri May 10 18:08:56 2002 +++ phpdoc/en/features/commandline.xml Tue May 14 05:06:23 2002 -1,5 +1,5 ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.3 $ -- +!-- $Revision: 1.4 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- -68,7 +68,9 entry It is desired that any output coming from functionprint/function, functionecho/function and friends is - immidiately written to the output and not cached in any buffer. + immidiately written to the output and not cached in any buffer. You + still can use link linkend=ref.outcontroloutput buffering/link + if you want to defer or manipulate standard output. /entry /row row -131,6 +133,7 ![CDATA[ $ pwd /tmp + $ php-cgi -f another_directory/test.php /tmp/another_directory ]] -144,6 +147,7 ![CDATA[ $ pwd /tmp + $ php -f another_directory/test.php /tmp ]] -273,11 +277,11 As long as the arguments you want to pass to your script do not start with the literal-/literal character, there's nothing special to watch out for. Passing an argument to your script which starts with a - literal-/literal will cause trouble because literalPHP/literal - thinks it has to handle it. To prevent this use the argument list separator - literal--/literal. After the argument has been parsed by - literalPHP/literal, every argument following it is passed - untoched/unparsed to your script. + literal-/literal will cause trouble because literalPHP/literal + itself thinks it has to handle it. To prevent this use the argument list + separator literal--/literal. After the argument has been parsed by + literalPHP/literal, every argument following it is passed + untoched/unparsed to your script. /para screen ![CDATA[ -395,9 +399,9 para Writes the PHP, PHP SAPI, and Zend version to standard output, e.g. screen -![CDATA[ +![CDATA[ $ php -v -PHP 4.3.0-dev (cli) +PHP 4.3.0-dev (cli), Copyright (c) 1997-2002 The PHP Group Zend Engine v1.2.1, Copyright (c) 1998-2002 Zend Technologies ]] /screen -412,7 +416,7 php.ini; or you can specify a custom literalINI/literal file directly (which does not need to be named php.ini;), e.g.: screen -![CDATA[ +![CDATA[ $ php -c /custom/directory/ my_script.php $ php -c /custom/directory/custom-file.ini my_script.php
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
mfischerFri May 10 17:11:06 2002 EDT Modified files: /phpdoc/en/features commandline.xml Log: - Initial cli documentation. # Now let's get this into the right place Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.1 phpdoc/en/features/commandline.xml:1.2 --- phpdoc/en/features/commandline.xml:1.1 Mon May 6 06:43:56 2002 +++ phpdoc/en/features/commandline.xml Fri May 10 17:11:05 2002 -1,18 +1,632 ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.1 $ -- -!-- - TODO: - - The command line options not in the - list, but in the -h output below: - - -e, -z - - It would be best to document these, and - collect more info about -c and -d! --- +!-- $Revision: 1.2 $ -- chapter id=features.commandline titleUsing PHP from the command line/title + !-- NEW DOCUMENTATION STARTS -- + para + Since version 4.3, literalPHP/literal supports a new + literalSAPI/literal type (Server Application Programming Interface) + named literalCLI/literal which means emphasisCommand Line + Interface/emphasis. As the name implies, this literalSAPI/literal type + main focus is on developing shell (or desktop as well) applications with + literalPHP/literal. There are quite some differences between the + literalCLI SAPI/literal and other literalSAPI/literals which are + further explained throughout this chapter. + /para + para + The literalCLI SAPI/literal was released for the first time with + literalPHP 4.2.0/literal, but was still experimental back then and had + to be explicitely enabled with literal--enable-cli/literal when running + literal./configure/literal. Since literalPHP 4.3.0/literal the + literalCLI SAPI/literal is no longer experimental and is therefore + emphasis role=strongalways/emphasis built and installed as the + filenamephp/filename (called filenamephp.exe/filename on Windows) + binary. + /para + para + Remarkable differences of the literalCLI SAPI/literal compared to other + literalSAPI/literals: + itemizedlist + listitem +para + Unlikely the literalCGI SAPI/literal, no headers are written to the + output. +/para +para + Though the literalCGI SAPI/literal provies a way to suppress HTTP + headers, there's not equivalent switch to enable them in the literalCLI + SAPI/literal. +/para + /listitem + listitem +para + The are certain php.ini; directives which are overriden by the literalCLI + SAPI/literal because the do not make sense in shell environments: + table + titleOverriden php.ini; directives/title + tgroup cols=3 + thead +row + entryDirective/entry + entryliteralCLI SAPI/literal default value/entry + entryComment/entry +/row + /thead + tbody +row + entrylink linkend=ini.html-errorshtml_errors/link/entry + entryfalse;/entry + entry + It can be quite hard to read the error message in your shell when + it's cluttered with all those meaningless literalHTML/literal + tags, therefore this directive defaults to false;. + /entry +/row +row + entrylink linkend=ini.implicit-flushimplicit_flush/link/entry + entrytrue;/entry + entry + It is desired that any output coming from + functionprint/function, functionecho/function and friends is + immidiately written to the output and not cached in any buffer. + /entry +/row +row + entrylink +linkend=ini.max-execution-timemax_execution_time/link/entry + entry0 (unlimited)/entry + entry + Due to endless possibilities of using literalPHP/literal in + shell environments, the maximum execution time has been set to + unlimited. Whereas applications written for the web are executed + within splits of a seconds, shell application tend to have a much + longer execution time. + /entry +/row +row + entrylink +linkend=ini.register-argc-argvregister_argc_argv/link/entry + entrytrue;/entry + entry + The global literalPHP/literal variables literal$argc/literal + (number of arguments passed to the application) and + literal$argv/literal (array of the actual arguments) are always + registered and filled in with the appropriate values when using the + literalCLI SAPI/literal. + /entry +/row + /tbody + /tgroup + /table +/para +note + para + This directives cannot be initialzied with another value from the + configuration file php.ini; or a custom one (if specified). This is a + limitation because those default values are applied after all + configuration files have been parsed. However, their value can be changed + during runtime (which
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
jan Fri May 10 18:08:57 2002 EDT Modified files: /phpdoc/en/features commandline.xml Log: - minor improvements # Nice work Markus! Index: phpdoc/en/features/commandline.xml diff -u phpdoc/en/features/commandline.xml:1.2 phpdoc/en/features/commandline.xml:1.3 --- phpdoc/en/features/commandline.xml:1.2 Fri May 10 17:11:05 2002 +++ phpdoc/en/features/commandline.xml Fri May 10 18:08:56 2002 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.2 $ -- +!-- $Revision: 1.3 $ -- chapter id=features.commandline titleUsing PHP from the command line/title !-- NEW DOCUMENTATION STARTS -- @@ -148,7 +148,7 @@ /tmp ]] /screen - This allows for greater flexibility when writing shell tools in + This allows greater flexibility when writing shell tools in literalPHP/literal. /para note @@ -229,7 +229,7 @@ /para note para - Read the example carefully, thera are no beginning or end tags! The + Read the example carefully, thera are no beginning or ending tags! The literal-r/literal switch simply does not need them. Using them will lead to a parser error. /para @@ -237,7 +237,7 @@ /listitem listitem para - Provide the literalPHP/literal code to execute via standard input + Provide the literalPHP/literal code to execute via standard input (literalstdin/literal). /para para @@ -259,7 +259,7 @@ accepts a number of arguments but also your literalPHP/literal script can receive them. The number of arguments which can be passed to your script is not limited by literalPHP/literal (the shell has a certain size limit - in numbers of characters which can be passed, usually you won't hit this + in numbers of characters which can be passed; usually you won't hit this limit). The arguments passed to your script are available in the global array literal$argv/literal. The zero index always contains the script name (which is literal-/literal in case the literalPHP/literal code @@ -271,11 +271,11 @@ /para para As long as the arguments you want to pass to your script do not start with - the literal-/literal character, there's nothing special to whatch out + the literal-/literal character, there's nothing special to watch out for. Passing an argument to your script which starts with a literal-/literal will cause trouble because literalPHP/literal thinks it has to handle it. To prevent this use the argument list separator - literal--/literal. After argument has been parsed by + literal--/literal. After the argument has been parsed by literalPHP/literal, every argument following it is passed untoched/unparsed to your script. /para @@ -297,8 +297,8 @@ ]] /screen para - But, there's another way of using literalPHP/literal for shell - scripting. You can write a script whose first line starts with + However, there's another way of using literalPHP/literal for shell + scripting. You can write a script which's first line starts with literal#!/usr/bin/php/literal and then following the normal literalPHP/literal code included within the literalPHP/literal starting and end tags and set the execution attributes of the file @@ -393,11 +393,13 @@ entry-v/entry entry para -Writes the PHP and Zend version to standard output, e.g. +Writes the PHP, PHP SAPI, and Zend version to standard output, e.g. screen +![CDATA[ $ php -v PHP 4.3.0-dev (cli) Zend Engine v1.2.1, Copyright (c) 1998-2002 Zend Technologies +]] /screen /para /entry @@ -410,9 +412,11 @@ php.ini; or you can specify a custom literalINI/literal file directly (which does not need to be named php.ini;), e.g.: screen +![CDATA[ $ php -c /custom/directory/ my_script.php $ php -c /custom/directory/custom-file.ini my_script.php +]] /screen /para /entry @@ -481,9 +485,9 @@ para Load Zend extension. If only a filename is given, PHP tries to load this extension from the current default library path on your system -(usually specified filename/etc/ld.so.conf/filename on Unix +(usually specified filename/etc/ld.so.conf/filename on Linux systems). Passing a filename with an absolute path information will -not use the systems library search path. A relative filename with a +not use the systems library search path. A relative filename with a directory information will tell literalPHP/literal only to try to load the extension relative to the current directory. /para @@ -521,6 +525,7 @@ Using this option, PHP prints out the built in (and loaded) PHP and Zend modules: screen +![CDATA[ $ php -m [PHP Modules] xml @@ -535,7 +540,7 @@ ctype [Zend Modules] - +]] /screen /para
[PHP-DOC] cvs: phpdoc /en/features commandline.xml
betzMon May 6 06:43:56 2002 EDT Added files: /phpdoc/en/features commandline.xml Log: moved commandline to chapters/features id correction in commandline.xml for chapters/features Index: phpdoc/en/features/commandline.xml +++ phpdoc/en/features/commandline.xml ?xml version=1.0 encoding=iso-8859-1? !-- $Revision: 1.1 $ -- !-- TODO: The command line options not in the list, but in the -h output below: -e, -z It would be best to document these, and collect more info about -c and -d! -- chapter id=features.commandline titleUsing PHP from the command line/title 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 gt; character, so literalphp -q test.php test.html/literal will print out the output of filenametest.php/filename without HTTP headers to the filenametest.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 filenamephp.exe/filename. /para para This list of command line options is consistent with PHP 4.0.6. You can get the actual list and some one line descriptions with the literal-h/literal option. The output of literalphp -h/literal should be something like this: screen ![CDATA[ Usage: php [-q] [-h] [-s [-v] [-i] [-f file] | {file [args...]} -q Quiet-mode. Suppress HTTP Header output. -s Display colour syntax highlighted source. -f file Parse file. Implies `-q' -v Version number -C Do not chdir to the script's directory -c path Look for php.ini file in this directory -d foo[=bar] Define INI entry foo with value 'bar' -e Generate extended information for debugger/profiler -z file Load Zend extension file. -l Syntax check only (lint) -m Show compiled in modules -i PHP information -h This help ]] /screen /para para Here we list some of the most important command line options with detailed explanations. /para para table titleCommand line options/title tgroup cols=2 thead row entryOption/entry entryDescription/entry /row /thead tbody row entry-q/entry entry Suppress HTTP headers output. Normally PHP prints out HTTP headers for the calling program (ie. webserver) to hand on to the browser. When writing command line applications these headers are useless. /entry /row row entry-s/entry entry Display the color highlighted source of the file given with its name. This is the same as if you were printing out the source using the functionhighlight_file/function function in a PHP script. /entry /row row entry-f/entry entry Parse the file given, and search for syntactical and fatal errors. This option implies -q. Use for debugging purposes. /entry /row row entry-v/entry entry By calling PHP with this option, you can ask it to print out its version number, ie: 4.0.6. /entry /row row entry-C/entry entry Normally PHP changes the working directory to the running scripts directory. This makes it possible for example, to open files in the same directory, with only specifying the name of the file. If you would like to disable this directory change, use this option. /entry /row row entry-c/entry entry Using this option, you can specify an alternative php.ini; path, so PHP will search your configurations file in this path instead of the default one. /entry /row row entry-d/entry entry With this option, you can set individual php.ini; settings in the time of running a script. /entry /row row entry-l/entry entry Check the file given for syntax errors. This option implies -q. Use for debugging purposes. This option won't find fatal errors (like undefined functions). Use -f if you would like to test for fatal errors too. /entry /row row entry-m/entry entry Using this option, PHP prints out the built in (and loaded) PHP