: 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.