This article mainly introduces the EXEC () function in PHP no return value of the method of troubleshooting, interested in the friend's reference, I hope to be helpful to everyone.
Installation fails on many servers that need to be used to exec security imagemagic
EXEC () failed to execute the external command, but there is no error message.
EXEC executes a command at the command line without problems, but in PHP there is an error. This issue 99.99% is related to permissions, but the command that exec executes does not return an error. One trick is to use the pipe command, assuming your exec call is as follows:
EXEC (' Convert a.jpg b.jpg ', $output, $return _val);
Can be changed as follows:
EXEC (' Convert a.jpg b.jpg 2>&1 ', $output, $return _val); Print_r ($output);
With 2>&1, the command outputs the error from the execution of the shell to the $output variable, which can be analyzed by outputting the variable.
Note: Exec has 3 parameters, the first is the command to execute, the second is an array, the value of the array is generated after the first command executes, the third parameter executes the state, 0 indicates success, and the others indicate failure.
In PHP There are a total of three functions that can be used to execute external command system,exec,passthru.
The above is the whole content of this article, I hope that everyone's study has helped.