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

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

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