What is the difference between shell_exec
and system
methods in PHP?
Both take a single command line argument and runs that within PHP. Is it better to use one over the other?
What is the difference between shell_exec
and system
methods in PHP?
Both take a single command line argument and runs that within PHP. Is it better to use one over the other?
See the explanation here:
http://chipmunkninja.com/Program-Execution-in-PHP%3A-exec-m@
With system is possible to capture the return code. Already with the shell_exec is not possible.
I think the main different is when PHP is running in safe mode. System will still work with some restriction as described in documentation however shell_exec will be disabled.