웹서버로 구현한 다음 1부터 N까지 더하는 cgi프로그래밍을 하게 되었는데.. cgi는 구현해서 thttpd로 실행해보니 잘 되었는데요.. 웹서버에서는 실행이 안되네요..
웹서버에서도 cgi 관련해서 어떤 설정을 해야될지 막막하네요.. 답변 부탁드려요..
아 그리고 구현은 c언어로 했습니다. 둘다..
그게 무슨 웹서버인지에 따라 설정이나 권한 조정이 필요할 것 같습니다. 저도 잘은 모르니 자세한 건 아래 고수님이...
아파치라면 일단 다음 항목들을 확인해보시죠.
http://httpd.apache.org/docs/trunk/howto/cgi.html
http://ubuntuforums.org/showthread.php?t=1178053
좋은 하루 되세요!
cgi 자체만 잘 구현하면 웹서버는 상관이 없는건지.. 혹시 cgi소스 중에 이상한 곳있으면 답변 부탁드려요~ 1부터 N까지의 숫자의 합을 구하는 프로그램입니다. #include #include #include
int main(void) { int i, result=0; char *data; long num;
printf("Content-Type: text/html\n\n");
printf("
\n"); data = getenv("QUERY_STRING"); if(data==NULL) { printf("<p>no string<br>\n"); printf("<p>plz add ?num=10 <br>\n"); } else if(sscanf(data, "num=%ld", &num)!=1) printf("<p>only parameter N<br>\n"); else for(i=0; i<=num; i++) result = result+i; printf("%d\n", result); printf("</body>\n"); return 0; }
텍스트 포맷에 대한 자세한 정보
<code>
<blockcode>
<apache>
<applescript>
<autoconf>
<awk>
<bash>
<c>
<cpp>
<css>
<diff>
<drupal5>
<drupal6>
<gdb>
<html>
<html5>
<java>
<javascript>
<ldif>
<lua>
<make>
<mysql>
<perl>
<perl6>
<php>
<pgsql>
<proftpd>
<python>
<reg>
<spec>
<ruby>
<foo>
[foo]
그게 무슨 웹서버인지에 따라 설정이나 권한 조정이
그게 무슨 웹서버인지에 따라 설정이나 권한 조정이 필요할 것 같습니다. 저도 잘은 모르니 자세한 건 아래 고수님이...
아파치라면 일단 다음 항목들을 확인해보시죠.
http://httpd.apache.org/docs/trunk/howto/cgi.html
http://ubuntuforums.org/showthread.php?t=1178053
좋은 하루 되세요!
웹서버랑 cgi 둘다 c로 구현했는데요..
cgi 자체만 잘 구현하면 웹서버는 상관이 없는건지..
혹시 cgi소스 중에 이상한 곳있으면 답변 부탁드려요~
1부터 N까지의 숫자의 합을 구하는 프로그램입니다.
#include
#include
#include
int main(void)
{
int i, result=0;
char *data;
long num;
printf("Content-Type: text/html\n\n");
printf("
댓글 달기