cgi with c programming
I'm trying simple example -
#include <stdio.h>
int main(void)
{
printf("Content-type: text/html\n\n");
printf("<html><title>Hello</title><body>\n");
printf("Goodbye Cruel World\n");
printf("</body></html>");
return 1;
}
compiled and moved to 开发者_Python百科apache docroot - but when i click on url - it comes as a popup and asks where to download/save this binary file? how to fix this?
Unfortunately, unless you already have other CGI scripts running in the same place, this is harder than just plopping a file somewhere - some stuff has to be configured in the web server to make it possible: apache settings, the .htaccess
file, permissions, and so on.
Make sure you read the Apache Tutorial on CGI to be up to date with what needs to be configured.
Check the similar one here but its c - cgi
- http://computer.howstuffworks.com/cgi3.htm
- CGI Scripting in C++
Method is same
精彩评论