PHP command line operation parameters and application

Source: Internet
Author: User
Tags php cli
PHP can be executed on a Web page, and PHP scripts can be executed at the command line via the PHP CLI (command line interface).

PHP can be executed on a Web page, and PHP scripts can be executed at the command line via the PHP CLI (command line interface). # execution format without parameters PHP installation directory/bin/php scriptname.php# execution format with parameters PHP installation directory/bin/php scriptname.php [parameter 1] [parameter 2] ... In scriptname.php through the $ARGV and $ARGC access parameter # $ARGV (formal notation $_server[' argv ']) array to save all parameters passed, note that the first parameter $argv[0]/$_server[' argv ' [ 0] For the name of the execution script, such as scriptname.php# $ARGC (formally $_server[' argc ')) holds the number of parameters

When the user opens the PHP page, the server executes the PHP command and sends the results to the user's browser, similar to the ASP and coildfusion,php can run on Windows and multiple versions of UNIX. In addition to being able to manipulate your page, PHP can also send the HTTP header.

You can set up cookies, manage digital signatures and redirect users, and it provides excellent connectivity to other databases (as well as ODBC), and integrates with various external libraries to do anything to parse XML with PDF documents. Do you also know that you can do something else with PHP's powerful features? When running in standalone CGI, you need a PHP executable, he has a lot of command-line arguments, some can be used for fun purposes, the following is all the PHP command line parameters, where [] means that the,<> table is necessary. Usage php [-Q] [-h] [-S] [-v] [-i] [-f] | {[args ...]} -Q Quiet mode. Do not output HTTP headers. -S converts PHP program files into color-coded HTML (such as reserved words in green, functions and variables in blue, notes in yellow and strings red, etc.). -F reads in and interprets the specified file. -C reads in the php.ini file-a interactive run-D Foo[=bar] Defines the input of the INI in the value of Foo for BAR-E output additional information for debugging and profiling-Z-in Zend extension file-I PHP related information-H help itself.

1. Use the Php-q file name. php method to use PHP as a shell program, 2. Use-S to HTML their own PHP program. Is this very worry? 3. Use PHP's ODBC functionality to manipulate the database in shell commands.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.