summaryrefslogtreecommitdiff
path: root/sapi/cli/php.1
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2003-02-07 22:12:02 +0000
committerMarcus Boerger <helly@php.net>2003-02-07 22:12:02 +0000
commit9e780033c272b9c10f5389c49b9edde20b8c0477 (patch)
treee183a2baf69ec66c38d4412bf4fbfa79fb5a89c7 /sapi/cli/php.1
parent383aa3c2d199edd9ec4df3db48c60d29da6d2489 (diff)
downloadphp-git-9e780033c272b9c10f5389c49b9edde20b8c0477.tar.gz
Adding some text and some backslashes which are needed sometimes
somewhere...
Diffstat (limited to 'sapi/cli/php.1')
-rw-r--r--sapi/cli/php.1113
1 files changed, 63 insertions, 50 deletions
diff --git a/sapi/cli/php.1 b/sapi/cli/php.1
index 0891f48573..aedd7a4f40 100644
--- a/sapi/cli/php.1
+++ b/sapi/cli/php.1
@@ -24,90 +24,90 @@ PHP Command Line Interface 'CLI'
.SH SYNOPSIS
.B php
[options] [
-.B -f
+.B \-f
]
.IR file
-[[--]
+[[\-\-]
.IR args
]
.LP
.B php
[options]
-.B -r
+.B \-r
.IR code
-[[--]
+[[\-\-]
.IR args
]
.LP
.B php
-[options] [-B
+[options] [\-B
.IR code
]
-.B -R
+.B \-R
.IR code
-[-E
+[\-E
.IR code
-] [[--]
+] [[\-\-]
.IR args
]
.LP
.B php
-[options] [-B
+[options] [\-B
.IR code
]
-.B -F
+.B \-F
.IR file
-[-E
+[\-E
.IR code
-] [[--]
+] [[\-\-]
.IR args
]
.LP
.B php
-[options] -- [
+[options] \-\- [
.IR args
]
.LP
.SH DESCRIPTION
.B PHP
-is a widely-used general-purpose scripting language that is especially suited for
+is a widely\-used general\-purpose scripting language that is especially suited for
Web development and can be embedded into HTML. This is the command line interface
that enables you to the following:
.P
-You can parse and execute files by using parameter -f followed by the name of the
+You can parse and execute files by using parameter \-f followed by the name of the
.IR file
to be executed.
.LP
-Using parameter -r you can directly execute PHP
+Using parameter \-r you can directly execute PHP
.IR code
simply as you would do inside a .php file when using the
.B eval()
function.
.LP
It is also possible to process the standard input line by line using either
-the parameter -R or -F. In this mode each separate input line causes the
+the parameter \-R or \-F. In this mode each separate input line causes the
.IR code
-specified by -R or the
+specified by \-R or the
.IR file
-specified by -F to be executed.
+specified by \-F to be executed.
You can access the input line by \fB$argn\fP. While processing the input lines
.B $argi
contains the number of the actual line being processed. Further more
-the paramters -B and -E can be used to execute
+the paramters \-B and \-E can be used to execute
.IR code
-(see -r) before and
+(see \-r) before and
after all input lines have been processed respectively.
.LP
-If none of -r -f -B -R -F or -E is present but a single parameter is given
+If none of \-r \-f \-B \-R \-F or \-E is present but a single parameter is given
then this parameter is taken as the filename to parse and execute (same as
-with -f). If no parameter is present then the standard input is read and
+with \-f). If no parameter is present then the standard input is read and
executed.
.SH OPTIONS
.TP 15
-.B -a
+.B \-a
Run interactively
.TP
-.B -c path|file
+.B \-c path|file
Look for
.B php.ini
file in the directory
@@ -115,109 +115,122 @@ file in the directory
or use the specified
.IR file
.TP
-.B -n
+.B \-n
No
.B php.ini
file will be used
.TP
-.B -d foo[=bar]
+.B \-d foo[=bar]
Define INI entry
.IR foo
with value
.IR bar
.TP
-.B -e
+.B \-e
Generate extended information for debugger/profiler
.TP
-.B -f file
+.B \-f file
Parse and execute
.IR file
.TP
-.B -h
+.B \-h
This help
.TP
-.B -i
+.B \-i
PHP information and configuration
.TP
-.B -l
+.B \-l
Syntax check only (lint)
.TP
-.B -m
+.B \-m
Show compiled in modules
.TP
-.B -r code
+.B \-r code
Run PHP
.IR code
without using script tags
.B '<?..?>'
.TP
-.B -B code
+.B \-B code
Run PHP
.IR code
before processing input lines
.TP
-.B -R code
+.B \-R code
Run PHP
.IR code
for every input line
.TP
-.B -F file
+.B \-F file
Parse and execute
.IR file
for every input line
.TP
-.B -E code
+.B \-E code
Run PHP
.IR code
after processing all input lines
.TP
-.B -s
+.B \-s
Display colour syntax highlighted source
.TP
-.B -v
+.B \-v
Version number
.TP
-.B -w
+.B \-w
Display source with stripped comments and whitespace
.TP
-.B -z file
+.B \-z file
Load Zend extension
.IR file
.TP
.IR args
Arguments passed to script. Use
-.B '--'
+.B '\-\-'
.IR args
when first argument starts with
-.B '-'
+.B '\-'
or script is read from stdin
.SH FILES
.TP 15
-.B php-cli.ini
+.B php\-cli.ini
The configuration file for the CLI version of PHP.
.TP
.B php.ini
The standard configuration file will only be used when
-.B php-cli.ini
+.B php\-cli.ini
cannot not be found.
.SH EXAMPLES
.TP 5
-php -r "echo 'Hello World';"
+php \-r 'echo "Hello World\\n";'
This command simply writes the text "Hello World" to stabdard out.
.TP
-php -d html_errors=1 -i | php -R 'echo strip_tags($argn)."\\n";'
+php \-r 'print_r(gd_info());'
+This shows the configuration of your gd extension. You can use this
+to easily check which imag formats you can use. If you have any
+dynamic modules you may want to use the same ini file that php uses
+when executed from your webserver. There are more extensions which
+have such a function. For dba use php \-r 'print_r(dba_handlers(1));'
+.TP
+php \-d html_errors=1 \-i | php \-R 'echo strip_tags($argn)."\\n";'
This example uses PHP first to generate a HTML output. This is
meant to be replaced with any tool that displays HTML (for instance
you could use 'cat file.html'). The second php command now strips off
the HTML tags line by line and outputs the result.
.TP
-php -E 'echo "Lines: $argi\\n";'
+php \-E 'echo "Lines: $argi\\n";'
This command shows the number of lines being input.
.TP
-php -R '@$l+=count(file($argn));' -E ' echo "Lines: $l\\n";'
+php \-R '$l+=count(file($argn));' \-E'echo "Lines:$l\\n";'
This commands expects each input line beeing a file. It counts all lines
of the files specified by each input line and shows the summarized result.
You may combine this with tools like find and change the php scriptlet.
+.TP
+php \-R 'echo $argn; fgets(STDIN);'
+Since you have access to STDIN from within \-B \-R and \-F you can skip certain
+input lines with your code. But note that in such cases $argi only counts the
+lines being processed by php itself. Having read this you will guess what the
+above program does: skipping every second input line.
.SH TIPS
You can use a shebang line to automatically invoke php
from scripts. Only the CLI version of PHP will ignore