Compiled C Executables As CGI Scripts

 
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI
View previous topic :: View next topic  
Author Message
jonedgeworth
-


Joined: 21 Jul 2003
Posts: 2

PostPosted: Mon Jul 21, 2003 7:46 pm    Post subject: Compiled C Executables As CGI Scripts Reply with quote

I recently installed the Abyss web server and all was great till I tried to get a CGI script to run.

I created a (very simple) c program - taken from a CGI tutorial at howstuffworks.com then compiled it using gcc (creating the executable file cgi_try.cgi) and placed it in the /cgi-bin/ directory of my server root. It compiled ok and gives the correct ouput when run under ms dos. However, when accessed through a browser the browser displays an "internal server error", error 500.

It seems that the CGI script is being run, as when the link to it from the page is clicked a DOS window is opened up briefly (with the heading ABYSSWS).

I have a dial up connection and I am running Abyss under windows Me. The browser I am using is Microsoft Explorer. Im pretty sure I have all the CGI paths correct and the script I am running is error free, it's exactly the same as given on the tutorial site, compiled in exactly the same way - and their version works.

Anyone got any ideas? Any help would be much appreciated - its been bugging me for hours now!

Jon :?
Back to top View user's profile Send private message MSN Messenger
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Wed Jul 23, 2003 6:13 pm    Post subject: Re: Compiled C Executables As CGI Scripts Reply with quote

CGI Executables under windows must have the .exe extension. Assume your executable is called test.exe. Put it in cgi-bin/ subdirectory (found in the directory whre you installed Abyss) and check that /cgi-bin is declared in the CGI Paths table. Next browse http://yoursite/cgi-bin/test.exe to see the result.

You can also test the following test.c:

Code:
#include <stdio.h>

int main()
{
   printf("Status: 200 OK\n\n");
   printf("This is a test");
   return 0;
}

_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
jonedgeworth
-


Joined: 21 Jul 2003
Posts: 2

PostPosted: Wed Jul 23, 2003 10:02 pm    Post subject: got it working Reply with quote

Thanks for the help, the executables were .exe files anyway.

Have solved the problem, was compiling the files using gcc but then compiled them using the compiler with Dev-C++. For some reason they then worked fine (both as .cgi and .exe files).
Back to top View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group