Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    C & CGI problems

    Hi,

    I am very very new to cgi scripting, and am in need of some assistance.

    I was recently given a cgi script, in the form of a C file. Being new to cgi, I checked some websites and was told to do the following:

    gcc -o test.cgi test.c

    This produced the executable to be run. If I run it from the command line, it works fine - though if I try to call http://myhost.com/cgi-bin/test.cgi I get a 500 Internal Server Error.

    I know that a perl cgi script works, as there was an example in the folder already.

    Is there a setting somewhere I should be fixing? Or shoul I be doing something differently to get a C program to cgi?

    Thanks in advance!
    Cb

  • #2
    Master Coder mlseim's Avatar
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,374
    Thanks
    8
    Thanked 1,075 Times in 1,066 Posts
    Are you using your own server, or a webhost?

    I don't imagine many webhosts have their cgi-bin directories
    set up for C (usually set up for Perl).

  • #3
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    I am hosting it locally, so I can make any configure changes if necessary - all I would need to know is what to change, or somewhere that might help me in deciding what to change.

    Thanks

  • #4
    Master Coder mlseim's Avatar
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,374
    Thanks
    8
    Thanked 1,075 Times in 1,066 Posts
    I don't have my own local server, but I found this ...
    It looks like they do it different than you did:

    http://computer.howstuffworks.com/cgi3.htm

    You didn't mention what the script was that you
    compiled and tried to run. But before anything is
    sent to the browser for display, you need to specify
    the type:

    printf("Content-type: text/html\n\n");

    This is true for both C and Perl.

    try some of the examples they show.

  • #5
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    Thanks for the reply,

    The examples on that website seem to work good. I guess this means there is a problem with this particular code, I will have to somehow figure out what to fix.

    Thanks for your help.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •