PHP command line execution program php.exe use and common parameters

Source: Internet
Author: User
Tags zend

PHP command line executor php.exe parameter description

-F <file>: Runs the specified PHP file as a command line, as long as the specific PHP file (with absolute path) is specified. Php.exe can execute PHP files, so this parameter single use in fact there is no matter, he is a bit like in the browser mode to display the results of PHP execution, the difference is because it is run as a command line, it is in the form of HTML source output, if there are errors, will also list error messages.

How to use

C:\php\php-f <file>

Or

c:\php\php <file>

-f <file>: corresponding to the Php.exe parameter-F, this parameter indicates that each input line executes the PHP file in the command line, using $ARGN and $argi two variables in the PHP file, and combining this parameter can do a lot of things. For example, according to the user's keyboard input to execute different program code, very interesting.

Knowledge Point: $argn represents the line content currently entered in the PHP command line, while $argi represents that line number, and for a single line, you can understand the input several times.

-I: the command-line argument invokes the Phpinfo () function and displays the result. If you execute this parameter php-cgi.exe, the difference between Php.exe and Php-cgi.exe is that the php-cgi executes this command parameter, the input is in HTML format, and the Php.exe is in the form of a variable, concise and straightforward.

How to use

C:\php\php-i

-L: Syntax checking of the specified PHP code, in fact, this command line parameter is useless, for fatal error, check not come out, this is why I did not use this parameter of Php.exe when configuring EditPlus's grammar Check tool. Note: This parameter cannot be used with-F.

How to use

C:\php\php-l <file>

-M: This command-line parameter is primarily used to output the built-in and loaded PHP and Zend modules

How to use

C:\php\php-m

-V: This command-line parameter is primarily used to output PHP and Zend version information

How to use

C:\php\php-v

–ini: This command-line parameter is primarily used to output the location information of a PHP configuration file

How to use

C:\php\php-r "Code"

–ini: This command-line parameter is primarily used to output the location information of a PHP configuration file

How to use

c:\php\php--ini

At this point, the basic usage and common parameters of the PHP command-line execution program Php.exe are finished,

We know that PHP programs usually run as Web pages, but you can run PHP scripts independently from the command line of PHP.

Reasonable use of php.exe, can achieve a lot of functions, such as we have been very bakery planning tasks,

The PHP command-line program Php.exe can be executed on the Windows platform by invoking the PHP shell in batch mode.

PHP command line execution program php.exe use and common parameters

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.