What is the best approach between using exec() and PHP functions (like rmdir(), unlink() etc.) when you are manipulating the filesystem?
What is the best approach between using exec() and PHP functions (like rmdir() ,
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The PHP versions in isolation will be faster than starting up a shell/invoking a process to carry out some operation. They’ll also be portable across across different operating systems and will be available even where the webserver does not have access to the standard shell commands (e.g. due to chroot / permissions).
However for particularly complex operations, then using an external command/process may be much faster, and require significantly less programming effort e.g. consider how you would implement this in php: