Ask Your Question

Revision history [back]

The PHP shell exec function runs a command in the shell and returns the output. When run on the command prompt, it has access to all the system resources and privileges.

However, in an HTML browser, the PHP script is executed by the web server, which runs with limited privileges and restrictions. The shell exec function may not have the necessary permissions to execute certain commands or access certain resources.

Additionally, allowing shell exec functions to run in a web environment can pose a security risk, as it can potentially execute malicious commands or expose sensitive information.

As a result, the PHP shell exec function is often disabled or restricted in a web environment, and alternative methods are used to achieve the desired functionality.