Annotation of embedaddon/php/sapi/cli/php.1, revision 1.1.1.1

1.1       misho       1: .TH PHP 1 "2010" "The PHP Group" "Scripting Language"
                      2: .SH NAME
                      3: php \- PHP Command Line Interface 'CLI'
                      4: .SH SYNOPSIS
                      5: .B php
                      6: [options] [
                      7: .B \-f\fP ]
                      8: .IR file
                      9: [[\-\-] 
                     10: .IR args.\|.\|. ]
                     11: .LP
                     12: .B php
                     13: [options] 
                     14: .B \-r 
                     15: .IR code
                     16: [[\-\-]
                     17: .IR args.\|.\|. ]
                     18: .LP
                     19: .B php
                     20: [options] [\-B 
                     21: .IR code ] 
                     22: .B \-R 
                     23: .IR code
                     24: [\-E 
                     25: .IR code ]
                     26: [[\-\-]
                     27: .IR args.\|.\|. ]
                     28: .LP
                     29: .B php
                     30: [options] [\-B 
                     31: .IR code ]
                     32: .B \-F 
                     33: .IR file
                     34: [\-E 
                     35: .IR code ] 
                     36: [[\-\-]
                     37: .IR args.\|.\|. ]
                     38: .LP
                     39: .B php
                     40: [options] \-\- [
                     41: .IR args.\|.\|. ]
                     42: .LP
                     43: \fBphp \fP[options] \fB\-a\fP
                     44: .LP
                     45: .SH DESCRIPTION
                     46: \fBPHP\fP is a widely\-used general\-purpose scripting language that is especially suited for 
                     47: Web development and can be embedded into HTML. This is the command line interface
                     48: that enables you to do the following:
                     49: .P
                     50: You can parse and execute files by using parameter \-f followed by the name of the 
                     51: .IR file 
                     52: to be executed.
                     53: .LP
                     54: Using parameter \-r you can directly execute PHP 
                     55: .IR code 
                     56: simply as you would do inside a
                     57: .B \.php
                     58: file when using the 
                     59: .B eval() 
                     60: function.
                     61: .LP
                     62: It is also possible to process the standard input line by line using either
                     63: the parameter \-R or \-F. In this mode each separate input line causes the
                     64: .IR code 
                     65: specified by \-R or the 
                     66: .IR file
                     67: specified by \-F to be executed.
                     68: You can access the input line by \fB$argn\fP. While processing the input lines
                     69: .B $argi 
                     70: contains the number of the actual line being processed. Further more
                     71: the parameters \-B and \-E can be used to execute 
                     72: .IR code
                     73: (see \-r) before and
                     74: after all input lines have been processed respectively. Notice that the
                     75: input is read from
                     76: .B STDIN
                     77: and therefore reading from 
                     78: .B STDIN 
                     79: explicitly changes the next input line or skips input lines.
                     80: .LP
                     81: If none of \-r \-f \-B \-R \-F or \-E is present but a single parameter is given 
                     82: then this parameter is taken as the filename to parse and execute (same as 
                     83: with \-f). If no parameter is present then the standard input is read and 
                     84: executed.
                     85: .SH OPTIONS
                     86: .TP 15
                     87: .PD 0
                     88: .B \-\-interactive
                     89: .TP
                     90: .PD 1
                     91: .B \-a
                     92: Run PHP interactively. This lets you enter snippets of PHP code that directly
                     93: get executed. When readline support is enabled you can edit the lines and also
                     94: have history support.
                     95: .TP
                     96: .PD 0
                     97: .B \-\-bindpath \fIaddress:port\fP|\fIport\fP
                     98: .TP
                     99: .PD 1
                    100: .B \-b \fIaddress:port\fP|\fIport\fP
                    101: Bind Path for external FASTCGI Server mode (CGI only).
                    102: .TP
                    103: .PD 0
                    104: .B \-\-no\-chdir
                    105: .TP
                    106: .PD 1
                    107: .B \-C
                    108: Do not chdir to the script's directory (CGI only).
                    109: .TP
                    110: .PD 0
                    111: .B \-\-no\-header
                    112: .TP
                    113: .PD 1
                    114: .B \-q
                    115: Quiet-mode. Suppress HTTP header output (CGI only).
                    116: .TP
                    117: .PD 0
                    118: .B \-\-timing \fIcount\fP
                    119: .TP
                    120: .PD 1
                    121: .B \-T \fIcount\fP
                    122: Measure execution time of script repeated count times (CGI only).
                    123: .TP
                    124: .PD 0
                    125: .B \-\-php\-ini \fIpath\fP|\fIfile\fP
                    126: .TP
                    127: .PD 1
                    128: .B \-c \fIpath\fP|\fIfile\fP
                    129: Look for 
                    130: .B php.ini 
                    131: file in the directory
                    132: .IR path
                    133: or use the specified
                    134: .IR file
                    135: .TP
                    136: .PD 0
                    137: .B \-\-no\-php\-ini
                    138: .TP
                    139: .PD 1
                    140: .B \-n
                    141: No 
                    142: .B php.ini 
                    143: file will be used
                    144: .TP
                    145: .PD 0
                    146: .B \-\-define \fIfoo\fP[=\fIbar\fP]
                    147: .TP
                    148: .PD 1
                    149: .B \-d \fIfoo\fP[=\fIbar\fP]
                    150: Define INI entry 
                    151: .IR foo 
                    152: with value
                    153: .IR bar
                    154: .TP
                    155: .B \-e
                    156: Generate extended information for debugger/profiler
                    157: .TP
                    158: .PD 0
                    159: .B \-\-file \fIfile\fP
                    160: .TP
                    161: .PD 1
                    162: .B \-f \fIfile\fP
                    163: Parse and execute 
                    164: .IR file
                    165: .TP
                    166: .PD 0
                    167: .B \-\-global \fIname\fP
                    168: .TP
                    169: .PD 1
                    170: .B \-g \fIname\fP
                    171: Make variable
                    172: .IR name
                    173: global in script.
                    174: .TP
                    175: .PD 0
                    176: .B \-\-help
                    177: .TP
                    178: .PD 1
                    179: .B \-h
                    180: This help
                    181: .TP
                    182: .PD 0
                    183: .B \-\-hide\-args
                    184: .TP
                    185: .PD 1
                    186: .B \-H
                    187: Hide script name (\fIfile\fP) and parameters (\fIargs\.\.\.\fP) from external 
                    188: tools. For example you may want to use this when a php script is started as 
                    189: a daemon and the command line contains sensitive data such as passwords.
                    190: .TP
                    191: .PD 0
                    192: .B \-\-info
                    193: .TP
                    194: .PD 1
                    195: .B \-i
                    196: PHP information and configuration
                    197: .TP
                    198: .PD 0
                    199: .B \-\-syntax\-check
                    200: .TP
                    201: .PD 1
                    202: .B \-l
                    203: Syntax check only (lint)
                    204: .TP
                    205: .PD 0
                    206: .B \-\-modules
                    207: .TP
                    208: .PD 1
                    209: .B \-m
                    210: Show compiled in modules
                    211: .TP
                    212: .PD 0
                    213: .B \-\-run \fIcode\fP
                    214: .TP
                    215: .PD 1
                    216: .B \-r \fIcode\fP
                    217: Run PHP 
                    218: .IR code
                    219: without using script tags
                    220: .B '<?..?>'
                    221: .TP
                    222: .PD 0
                    223: .B \-\-process\-begin \fIcode\fP
                    224: .TP
                    225: .PD 1
                    226: .B \-B \fIcode\fP
                    227: Run PHP 
                    228: .IR code
                    229: before processing input lines
                    230: .TP
                    231: .PD 0
                    232: .B \-\-process\-code \fIcode\fP
                    233: .TP
                    234: .PD 1
                    235: .B \-R \fIcode\fP
                    236: Run PHP 
                    237: .IR code
                    238: for every input line
                    239: .TP
                    240: .PD 0
                    241: .B \-\-process\-file \fIfile\fP
                    242: .TP
                    243: .PD 1
                    244: .B \-F \fIfile\fP
                    245: Parse and execute 
                    246: .IR file
                    247: for every input line
                    248: .TP
                    249: .PD 0
                    250: .B \-\-process\-end \fIcode\fP
                    251: .TP
                    252: .PD 1
                    253: .B \-E \fIcode\fP
                    254: Run PHP 
                    255: .IR code
                    256: after processing all input lines
                    257: .TP
                    258: .PD 0
                    259: .B \-\-syntax\-highlight
                    260: .TP
                    261: .PD 1
                    262: .B \-s
                    263: Output HTML syntax highlighted source
                    264: .TP
                    265: .PD 0
                    266: .B \-\-version
                    267: .TP
                    268: .PD 1
                    269: .B \-v
                    270: Version number
                    271: .TP
                    272: .PD 0
                    273: .B \-\-stripped
                    274: .TP
                    275: .PD 1
                    276: .B \-w
                    277: Output source with stripped comments and whitespace
                    278: .TP
                    279: .PD 0
                    280: .B \-\-zend\-extension \fIfile\fP
                    281: .TP
                    282: .PD 1
                    283: .B \-z \fIfile\fP
                    284: Load Zend extension 
                    285: .IR file
                    286: .TP
                    287: .IR args.\|.\|.
                    288: Arguments passed to script. Use 
                    289: .B '\-\-'
                    290: .IR args
                    291: when first argument starts with 
                    292: .B '\-'
                    293: or script is read from stdin
                    294: .TP
                    295: .PD 0
                    296: .B \-\-rfunction
                    297: .IR name
                    298: .TP
                    299: .PD 1
                    300: .B \-\-rf
                    301: .IR name
                    302: Shows information about function
                    303: .B name
                    304: .TP
                    305: .PD 0
                    306: .B \-\-rclass
                    307: .IR name
                    308: .TP
                    309: .PD 1
                    310: .B \-\-rc
                    311: .IR name
                    312: Shows information about class
                    313: .B name
                    314: .TP
                    315: .PD 0
                    316: .B \-\-rextension
                    317: .IR name
                    318: .TP
                    319: .PD 1
                    320: .B \-\-re
                    321: .IR name
                    322: Shows information about extension
                    323: .B name
                    324: .TP
                    325: .PD 0
                    326: .B \-\-rzendextension
                    327: .IR name
                    328: .TP
                    329: .PD 1
                    330: .B \-\-rz
                    331: .IR name
                    332: Shows information about Zend extension
                    333: .B name
                    334: .TP
                    335: .PD 0
                    336: .B \-\-rextinfo
                    337: .IR name
                    338: .TP
                    339: .PD 1
                    340: .B \-\-ri
                    341: .IR name
                    342: Shows configuration for extension
                    343: .B name
                    344: .TP
                    345: .B \-\-ini
                    346: Show configuration file names
                    347: .SH FILES
                    348: .TP 15
                    349: .B php\-cli.ini
                    350: The configuration file for the CLI version of PHP.
                    351: .TP
                    352: .B php.ini
                    353: The standard configuration file will only be used when 
                    354: .B php\-cli.ini
                    355: cannot be found.
                    356: .SH EXAMPLES
                    357: .TP 5
                    358: \fIphp \-r 'echo "Hello World\\n";'\fP
                    359: This command simply writes the text "Hello World" to standard out.
                    360: .TP
                    361: \fIphp \-r 'print_r(gd_info());'\fP
                    362: This shows the configuration of your gd extension. You can use this
                    363: to easily check which image formats you can use. If you have any
                    364: dynamic modules you may want to use the same ini file that php uses
                    365: when executed from your webserver. There are more extensions which
                    366: have such a function. For dba use:
                    367: .RS
                    368: \fIphp \-r 'print_r(dba_handlers(1));'\fP
                    369: .RE
                    370: .TP
                    371: \fIphp \-R 'echo strip_tags($argn)."\\n";'\fP
                    372: This PHP command strips off the HTML tags line by line and outputs the 
                    373: result. To see how it works you can first look at the following PHP command
                    374: \'\fIphp \-d html_errors=1 \-i\fP\' which uses PHP to output HTML formatted
                    375: configuration information. If you then combine those two 
                    376: \'\fIphp \.\.\.|php \.\.\.\fP\' you'll see what happens.
                    377: .TP
                    378: \fIphp \-E 'echo "Lines: $argi\\n";'\fP
                    379: Using this PHP command you can count the lines being input.
                    380: .TP
                    381: \fIphp \-R '@$l+=count(file($argn));' \-E 'echo "Lines:$l\\n";'\fP
                    382: In this example PHP expects each input line being a file. It counts all lines 
                    383: of the files specified by each input line and shows the summarized result. 
                    384: You may combine this with tools like find and change the php scriptlet.
                    385: .TP
                    386: \fIphp \-R 'echo "$argn\\n"; fgets(STDIN);'\fP
                    387: Since you have access to STDIN from within \-B \-R \-F and \-E you can skip 
                    388: certain input lines with your code. But note that in such cases $argi only 
                    389: counts the lines being processed by php itself. Having read this you will 
                    390: guess what the above program does: skipping every second input line.
                    391: .SH TIPS
                    392: You can use a shebang line to automatically invoke php
                    393: from scripts. Only the CLI version of PHP will ignore
                    394: such a first line as shown below:
                    395: .P
                    396: .PD 0
                    397: .RS
                    398: #!/bin/php
                    399: .P
                    400: <?php
                    401: .P
                    402:  // your script
                    403: .P
                    404: ?>
                    405: .RE
                    406: .PD 1
                    407: .P
                    408: .SH SEE ALSO
                    409: For a more or less complete description of PHP look here:
                    410: .PD 0
                    411: .P
                    412: .B http://www.php.net/manual/
                    413: .PD 1
                    414: .P
                    415: .SH BUGS
                    416: You can view the list of known bugs or report any new bug you
                    417: found at:
                    418: .PD 0
                    419: .P
                    420: .B http://bugs.php.net
                    421: .PD 1
                    422: .SH AUTHORS
                    423: The PHP Group: Thies C. Arntzen, Stig Bakken, Andi Gutmans, Rasmus Lerdorf, Sam Ruby, Sascha Schumann, Zeev Suraski, Jim Winstead, Andrei Zmievski.
                    424: .P
                    425: Additional work for the CLI sapi was done by Edin Kadribasic, Marcus Boerger and Johannes Schlueter.
                    426: .P
                    427: A List of active developers can be found here:
                    428: .PD 0
                    429: .P
                    430: .B http://www.php.net/credits.php
                    431: .PD 1
                    432: .P
                    433: And last but not least PHP was developed with the help of a huge amount of 
                    434: contributors all around the world.
                    435: .SH VERSION INFORMATION
                    436: This manpage describes \fBphp\fP, version 5.4.3.
                    437: .SH COPYRIGHT
                    438: Copyright \(co 1997\-2010 The PHP Group
                    439: .LP
                    440: This source file is subject to version 3.01 of the PHP license,
                    441: that is bundled with this package in the file LICENSE, and is
                    442: available through the world-wide-web at the following url:
                    443: .PD 0
                    444: .P
                    445: .B http://www.php.net/license/3_01.txt
                    446: .PD 1
                    447: .P
                    448: If you did not receive a copy of the PHP license and are unable to
                    449: obtain it through the world-wide-web, please send a note to
                    450: .B license@php.net
                    451: so we can mail you a copy immediately.

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>