Annotation of embedaddon/php/sapi/cli/php.1.in, revision 1.1.1.3

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

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