Referring to a comment from someone on the question here:
While it is possible to make the script commands safe, a common attack vector is to upload a malicious script and use exec and similar functions to hack the server. As such, many shared hosting environments disable this and any other function that can run a shell argument.
Is this true? Is my server in risk of being attacked simply because I enable the php scripts to run the exec() method?
What can I do to prevent hackers from uploading files on my server? Or are there any other countermeasure that allows me to use the exec method safely?
exec()is that you accept user input and integrate it into the command in some fashion. If you do not untaint or validate it carefully, you could end up running a destructive command that you would not wish to allow.