Annotation of embedaddon/php/sapi/cli/php.1.in, revision 1.1.1.4
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 \-\-global \fIname\fP
182: .TP
183: .PD 1
184: .B \-g \fIname\fP
185: Make variable
186: .IR name
187: global in script.
188: .TP
189: .PD 0
190: .B \-\-help
191: .TP
192: .PD 1
193: .B \-h
194: This help
195: .TP
196: .PD 0
197: .B \-\-hide\-args
198: .TP
199: .PD 1
200: .B \-H
201: Hide script name (\fIfile\fP) and parameters (\fIargs\.\.\.\fP) from external
202: tools. For example you may want to use this when a php script is started as
203: a daemon and the command line contains sensitive data such as passwords.
204: .TP
205: .PD 0
206: .B \-\-info
207: .TP
208: .PD 1
209: .B \-i
210: PHP information and configuration
211: .TP
212: .PD 0
213: .B \-\-syntax\-check
214: .TP
215: .PD 1
216: .B \-l
217: Syntax check only (lint)
218: .TP
219: .PD 0
220: .B \-\-modules
221: .TP
222: .PD 1
223: .B \-m
224: Show compiled in modules
225: .TP
226: .PD 0
227: .B \-\-run \fIcode\fP
228: .TP
229: .PD 1
230: .B \-r \fIcode\fP
231: Run PHP
232: .IR code
233: without using script tags
234: .B '<?..?>'
235: .TP
236: .PD 0
237: .B \-\-process\-begin \fIcode\fP
238: .TP
239: .PD 1
1.1.1.4 ! misho 240: .B \-B \fIbegin_code\fP
1.1 misho 241: Run PHP
1.1.1.4 ! misho 242: .IR begin_code
1.1 misho 243: before processing input lines
244: .TP
245: .PD 0
246: .B \-\-process\-code \fIcode\fP
247: .TP
248: .PD 1
249: .B \-R \fIcode\fP
250: Run PHP
251: .IR code
252: for every input line
253: .TP
254: .PD 0
255: .B \-\-process\-file \fIfile\fP
256: .TP
257: .PD 1
258: .B \-F \fIfile\fP
259: Parse and execute
260: .IR file
261: for every input line
262: .TP
263: .PD 0
264: .B \-\-process\-end \fIcode\fP
265: .TP
266: .PD 1
1.1.1.4 ! misho 267: .B \-E \fIend_code\fP
1.1 misho 268: Run PHP
1.1.1.4 ! misho 269: .IR end_code
1.1 misho 270: after processing all input lines
271: .TP
272: .PD 0
273: .B \-\-syntax\-highlight
274: .TP
275: .PD 1
276: .B \-s
277: Output HTML syntax highlighted source
278: .TP
279: .PD 0
1.1.1.3 misho 280: .B \-\-server \fIaddr:port\fP
281: .TP
282: .PD 1
283: .B \-S \fIaddr:port\fP
1.1.1.4 ! misho 284: Start built-in web server on the given local address and port
1.1.1.3 misho 285: .TP
286: .PD 0
287: .B \-\-docroot \fIdocroot\fP
288: .TP
289: .PD 1
290: .B \-t \fIdocroot\fP
1.1.1.4 ! misho 291: Specify the document root to be used by the built-in web server
1.1.1.3 misho 292: .TP
293: .PD 0
1.1 misho 294: .B \-\-version
295: .TP
296: .PD 1
297: .B \-v
298: Version number
299: .TP
300: .PD 0
301: .B \-\-stripped
302: .TP
303: .PD 1
304: .B \-w
305: Output source with stripped comments and whitespace
306: .TP
307: .PD 0
308: .B \-\-zend\-extension \fIfile\fP
309: .TP
310: .PD 1
311: .B \-z \fIfile\fP
312: Load Zend extension
313: .IR file
314: .TP
315: .IR args.\|.\|.
316: Arguments passed to script. Use
317: .B '\-\-'
318: .IR args
319: when first argument starts with
320: .B '\-'
321: or script is read from stdin
322: .TP
323: .PD 0
324: .B \-\-rfunction
325: .IR name
326: .TP
327: .PD 1
328: .B \-\-rf
329: .IR name
330: Shows information about function
331: .B name
332: .TP
333: .PD 0
334: .B \-\-rclass
335: .IR name
336: .TP
337: .PD 1
338: .B \-\-rc
339: .IR name
340: Shows information about class
341: .B name
342: .TP
343: .PD 0
344: .B \-\-rextension
345: .IR name
346: .TP
347: .PD 1
348: .B \-\-re
349: .IR name
350: Shows information about extension
351: .B name
352: .TP
353: .PD 0
1.1.1.2 misho 354: .B \-\-rzendextension
355: .IR name
356: .TP
357: .PD 1
358: .B \-\-rz
359: .IR name
360: Shows information about Zend extension
361: .B name
362: .TP
363: .PD 0
1.1 misho 364: .B \-\-rextinfo
365: .IR name
366: .TP
367: .PD 1
368: .B \-\-ri
369: .IR name
370: Shows configuration for extension
371: .B name
372: .TP
373: .B \-\-ini
374: Show configuration file names
375: .SH FILES
376: .TP 15
377: .B php\-cli.ini
378: The configuration file for the CLI version of PHP.
379: .TP
380: .B php.ini
381: The standard configuration file will only be used when
382: .B php\-cli.ini
383: cannot be found.
384: .SH EXAMPLES
385: .TP 5
386: \fIphp \-r 'echo "Hello World\\n";'\fP
387: This command simply writes the text "Hello World" to standard out.
388: .TP
389: \fIphp \-r 'print_r(gd_info());'\fP
390: This shows the configuration of your gd extension. You can use this
391: to easily check which image formats you can use. If you have any
392: dynamic modules you may want to use the same ini file that php uses
393: when executed from your webserver. There are more extensions which
394: have such a function. For dba use:
395: .RS
396: \fIphp \-r 'print_r(dba_handlers(1));'\fP
397: .RE
398: .TP
399: \fIphp \-R 'echo strip_tags($argn)."\\n";'\fP
400: This PHP command strips off the HTML tags line by line and outputs the
401: result. To see how it works you can first look at the following PHP command
402: \'\fIphp \-d html_errors=1 \-i\fP\' which uses PHP to output HTML formatted
403: configuration information. If you then combine those two
404: \'\fIphp \.\.\.|php \.\.\.\fP\' you'll see what happens.
405: .TP
406: \fIphp \-E 'echo "Lines: $argi\\n";'\fP
407: Using this PHP command you can count the lines being input.
408: .TP
409: \fIphp \-R '@$l+=count(file($argn));' \-E 'echo "Lines:$l\\n";'\fP
410: In this example PHP expects each input line being a file. It counts all lines
411: of the files specified by each input line and shows the summarized result.
412: You may combine this with tools like find and change the php scriptlet.
413: .TP
414: \fIphp \-R 'echo "$argn\\n"; fgets(STDIN);'\fP
415: Since you have access to STDIN from within \-B \-R \-F and \-E you can skip
416: certain input lines with your code. But note that in such cases $argi only
417: counts the lines being processed by php itself. Having read this you will
418: guess what the above program does: skipping every second input line.
419: .SH TIPS
420: You can use a shebang line to automatically invoke php
421: from scripts. Only the CLI version of PHP will ignore
422: such a first line as shown below:
423: .P
424: .PD 0
425: .RS
426: #!/bin/php
427: .P
428: <?php
429: .P
430: // your script
431: .P
432: ?>
433: .RE
434: .PD 1
435: .P
436: .SH SEE ALSO
437: For a more or less complete description of PHP look here:
438: .PD 0
439: .P
440: .B http://www.php.net/manual/
441: .PD 1
442: .P
443: .SH BUGS
444: You can view the list of known bugs or report any new bug you
445: found at:
446: .PD 0
447: .P
448: .B http://bugs.php.net
449: .PD 1
450: .SH AUTHORS
451: The PHP Group: Thies C. Arntzen, Stig Bakken, Andi Gutmans, Rasmus Lerdorf, Sam Ruby, Sascha Schumann, Zeev Suraski, Jim Winstead, Andrei Zmievski.
452: .P
453: Additional work for the CLI sapi was done by Edin Kadribasic, Marcus Boerger and Johannes Schlueter.
454: .P
455: A List of active developers can be found here:
456: .PD 0
457: .P
458: .B http://www.php.net/credits.php
459: .PD 1
460: .P
461: And last but not least PHP was developed with the help of a huge amount of
462: contributors all around the world.
463: .SH VERSION INFORMATION
464: This manpage describes \fBphp\fP, version @PHP_VERSION@.
465: .SH COPYRIGHT
1.1.1.3 misho 466: Copyright \(co 1997\-2013 The PHP Group
1.1 misho 467: .LP
468: This source file is subject to version 3.01 of the PHP license,
469: that is bundled with this package in the file LICENSE, and is
470: available through the world-wide-web at the following url:
471: .PD 0
472: .P
473: .B http://www.php.net/license/3_01.txt
474: .PD 1
475: .P
476: If you did not receive a copy of the PHP license and are unable to
477: obtain it through the world-wide-web, please send a note to
478: .B license@php.net
479: so we can mail you a copy immediately.
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>