View previous topic :: View next topic |
Author |
Message |
jonedgeworth -
Joined: 21 Jul 2003 Posts: 2
|
Posted: Mon Jul 21, 2003 7:46 pm Post subject: Compiled C Executables As CGI Scripts |
|
|
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 |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Wed Jul 23, 2003 6:13 pm Post subject: Re: Compiled C Executables As CGI Scripts |
|
|
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 |
|
|
jonedgeworth -
Joined: 21 Jul 2003 Posts: 2
|
Posted: Wed Jul 23, 2003 10:02 pm Post subject: got it working |
|
|
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 |
|
|
|