Phpexec usage details

Source: Internet
Author: User
: This article describes how to use phpexec. if you are interested in the PHP Tutorial, refer to it. Exec function parsing

Exec syntax: string exec (string command, string [array], int [return_var]);

Exec return value: string

Exec parameter description

Command-Command to be executed

Array-is the output value

Return_var-returns 0 or 1. if 0 is returned, the execution is successful. if 1 is returned, the execution fails.

Exec failed, debugging solution

One trick is to use the pipeline command. with 2> & 1, the command will output the $ output variable error during shell execution and output the variable for analysis.

For example:

Exec ('convert a.jpg B .jpg ', $ output, $ return_val );

Changed:

Exec ('convert a.jpg B .jpg 2> & 1', $ output, $ return_val );

Print_r ($ output );


Example:

Running the java parsing command with exec on win2003 has never been successful:

C: \ Progra ~ 1 \ Java \ jdk1.8.0 _ 73 \ bin \ java.exe-jar c: \ p \ java \ test. jar

After the command is appended with 2> & 1, it is amazing.

Exec ("C: \ Progra ~ 1 \ Java \ jdk1.8.0 _ 73 \ bin \ java.exe-jar c: \ p \ java \ test. jar 2> & 1 ", $ output, $ return_val );






The above describes the usage of php exec, including relevant content, and hopes to help those who are interested in PHP tutorials.

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.