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.
Transfer from http://blog.csdn.net/aoyoo111/article/details/21049759
For more wonderful posts, please go to a blog with a salty message.
Website: http://blog.csdn.net/aoyoo111
PHP exec () function no return value troubleshooting method [Go]