What are the potential ways to execute a CGI script in PHP and display the output on a webpage?

To execute a CGI script in PHP and display the output on a webpage, you can use the `exec()` function to run the CGI script and capture its output. Then, you can simply echo the output onto the webpage. Make sure that the CGI script is executable and has the correct permissions set.

<?php
$command = '/path/to/cgi/script.cgi';
$output = exec($command);
echo $output;
?>