development and can be embedded into HTML. This is the command line interface that enables
you to do the following:
file when using the eval() function.
-R or -F. In this mode each separate input line causes the code specified by -R or the
file specified by -F to be executed. You can access the input line by $argn. While pro‐
cessing the input lines $argi contains the number of the actual line being processed. Fur‐
ther more the parameters -B and -E can be used to execute code (see -r) before and after
all input lines have been processed respectively. Notice that the input is read from STDIN
and therefore reading from STDIN explicitly changes the next input line or skips input
-S option where addr:port 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 docroot passed by the -t option.
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 executed.
Interactive mode enabled
如上示例，php >为提示符。我们在交互模式中执行PHP代码var_dump(array([‘c1’ => ‘red’]));，这与在PHP脚本中执行是类似的。
–bindpath address:port|port，-b address:port|port
-C Do not chdir to the script’s directory (CGI only).
-q Quiet-mode. Suppress HTTP header output (CGI only).
-T count Measure execution time of script repeated count times (CGI only).
-c path|file Look for php.ini file in the directory path or use the specified file
-n No php.ini file will be used
-d foo[=bar] Define INI entry foo with value bar
-f file Parse and execute file
-h This help
-H Hide script name (file) and parameters (args…) from external tools. For
and the command line contains sensitive data such as passwords.
-i PHP information and configuration
-l Syntax check only (lint)
-m Show compiled in modules
-r code Run PHP code without using script tags ‘<?..?>’
-B begin_code Run PHP begin_code before processing input lines
-R code Run PHP code for every input line
-F file Parse and execute file for every input line
-E end_code Run PHP end_code after processing all input lines
-s Output HTML syntax highlighted source
-S addr:port Start built-in web server on the given local address and port
-t docroot Specify the document root to be used by the built-in web server
-v Version number
-w Output source with stripped comments and whitespace
-z file Load Zend extension file
–rf name Shows information about function name
–rc name Shows information about class name
–re name Shows information about extension name
–ri name Shows configuration for extension name
which image 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));’
how it works you can first look at the following PHP command ´php -d html_errors=1
-i´ which uses PHP to output HTML formatted configuration information. If you then
combine those two ´php …|php …´ you’ll see what happens.
files specified by each input line and shows the summarized result. You may combine
this with tools like find and change the php scriptlet.
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.
of PHP will ignore such a first line as shown below:
// your script
- man 1 php, version 5.6.34