What are the potential security risks of executing shell commands through PHP on a website?

Executing shell commands through PHP on a website can lead to security risks such as command injection attacks, where an attacker can manipulate the input to execute arbitrary commands on the server. To mitigate this risk, it is recommended to use PHP's built-in functions like `escapeshellarg()` or `escapeshellcmd()` to sanitize user input before passing it to shell commands.

$user_input = $_POST['user_input'];
$escaped_input = escapeshellarg($user_input);
shell_exec("some_command " . $escaped_input);