Server Side: Writing CGI using C

started by Flaxen on Mar 6, 2004 — RSS Feed

Flaxen Flaxen
Posts: 28

I'm experimenting with writing CGI using C. The writing of the code is not the problem it's the execution of the code that has stumped me. Using Perl I simply point at the cgi-bin directory, the server finds the perl code and executes it. So, my first efforts with my cleanly compiled binaries was to put them into the cgi-bin directory in the hope that the server would recognise it was binary rather than perl and execute the same. Somewhat naive perhaps, so I wasn't entirely surprised when that didn't work. After much digging around on the web I still can't find the correct way to execute CGI written in C. I own the server so if it's an apache configuration requirement no problem, otherwise can someone give me a few tips or URL's that'll point me in the right direction ?

Joe Gillespie Joe Gillespie
Posts: 528

Have you added .exe to the AddHandler line in httpd.conf?

AddHandler cgi-script .cgi .pl .exe

Apache has to be told that it can expect an .exe because that's what a compiled C cgi would be.

Also, check your cgi log file and see what errors are thrown up.

You are not using Apache on Windows by any chance? I don't think C cgis will work on Windows.

You must login to reply