How can PHP be used to execute Linux commands?

To execute Linux commands using PHP, you can use the `shell_exec()` function. This function allows you to run shell commands and return the output as a string. However, be cautious when using this function as it can pose security risks if not handled properly.

$command = 'ls -la';
$output = shell_exec($command);
echo "<pre>$output</pre>";