#setting Apache2 up for C cgi programs
#install needed programs
sudo apt-get install build-essential vim apache2
##########create C code 'vim test.c'###########
#include
int main(){
printf("Content-type:text/plain\n\n");
printf("Hello, you are still learning C!!\n");
return 0;
}
################################################
#compile code and put it in cgi folder for apache
gcc test.c test
sudo cp test /usr/lib/cgi-bin/
#enable cgi for apache and restart server
sudo a2enmod cgi
sudo service apache2 restart
###################################another cgi example with user variables##################
/*****************************************************************
* C Programming in Linux (c) David Haskins 2008
* chapter1_3.c *
*****************************************************************/
#include
int main(int argc, char *argv[]){
int i=0;
printf("Content-type:text/plain\n\n");
printf("Hello, you are still learning C!!\n");
printf("Number of arguments to the main function:%d\n", argc);
for(i=0;i