The difference between the system and shell_exec

What is the difference between shell_exec and system methods in PHP?

Both take one command line argument and run this in PHP. Is it better to use one over the other?

+6
source share
3 answers

You can lock a return code with the system. Already with shell_exec it is impossible.

+3
source

I think the main difference is that PHP is running in safe mode. The system will work with some restriction, as described in the documentation, however shell_exec will be disabled.

+2
source

Source: https://habr.com/ru/post/916955/