It doesn't have too much to be done with apache. The main key in this is PHP. You can try using PHP's system() function, like
<?php system("/usr/bin/uptime"); ?>
or any other program. Just make sure the executable's permissions are set correctly, so the user which apache (php) runs on, can execute it.
Also you may be interested in PHP shell that will allow you to execute commands from webpage.
You can download it from http://spider-it.eu.org/download.php?view.9