I wrote my first cgi script today.. it actually sounds pretty juvenile now that i say it out loud.
here it is… ( i really need to read the geshi docs so i can format this properly!)
#include
int main(){
std::cout <<”Content-Type: text/html<html>\n\n “;
std::cout << “text.”;
std::cout << “</html>”;
return 0;
}
Anyway, it compiled pretty easily as a cgi script; getting it to run in apache took me a few minutes, as a matter of fact, i am afraid i hosed some stuff on this test system trying to get it working. I finally added
Options +ExecCGI
to the apache2 config file — in ubuntu, i actually modified the /etc/apache2/sites-available/default file, under the Directory /var/www tag.
This allowed me to run the cgi.. at least.. i tried 84 things, so I -think- that’s what finally worked
tomorrow i’d like to try some post/get forms with c++, i write my forms with so much php that i’m not sure how i’ll do it with c.
btw - thanks to http://www.metalshell.com/view/source/127/ for the idea.

0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment