For simple scripts shell is pretty good. It's a sane choice if you plan on embedding a Web application on a device, as PHP is a bit of a PIG.
The Apache2 configuration with .htaccess is straight forward:
Options +ExecCGI AddHandler cgi-script .cgi
However if you are embedding CGI, use a light httpd like nostromo httpd.
The important element with HTML shell CGI scripts in to ensure you have "Content-Type: text/html" in there with a couple of carriage returns.
#!/bin/sh title="Shell CGI" cat <<END Cache-Control: no-cache Content-Type: text/html <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>$title</title> </head> <body> <pre> END wget http://webconverger.com/flower100.png &> /dev/stdout || echo "Permission denied" env cat <<END </pre> </body> </html> END
/dev/stderr outputs to
/var/log/apache2/error.log so you need redirect
wget output to stdout as I do in this case.