What is the potential issue with using shell_exec in PHP code?

The potential issue with using shell_exec in PHP code is that it can pose a security risk by allowing arbitrary shell commands to be executed on the server. To solve this issue, it is recommended to use escapeshellarg() or escapeshellcmd() functions to sanitize the input before passing it to shell_exec.

$command = escapeshellcmd($user_input);
$output = shell_exec($command);