tags:

views:

167

answers:

1

I downloaded the developerkit from fastcgi.com. The kit has an examples folder that has a few source files their final, runnable, compiled files. If I put these compiled files in a cgi-bin folder on my apache server (my macbook pro), add the extension fcgi, and go to the url that they are located, they run perfect.

I have a test c soruce file that I want to compile to a fastcgi script. The source file simply prints hello world.

Does anyone have a good ref or easy explanation on how to compile the source file to a runnable fcgi file? I dont understand the docs...

+1  A: 

Its a mistake to think of your program as a script. That being said, a FastCGI application needs two things:

  1. A web server that is able to pass requests to it (usually on port 9000)
  2. The FastCGI library

Presumably, you have installed FastCGI (including the shared objects and headers) and have written something that uses it. You would then compile it via:

gcc -Wall -o myfastcgiapp -lfcgi myfastcgiapp.c

You will then need to configure your web server to start it and pass requests to it. I'm pretty sure, from the limited information you provided that you forgot to tell the linker that you were using symbols from FastCGI (hence -Lfcgi).

It could also be that you did not install the library correctly.

More information such as:

  1. Web server being used
  2. Compiler errors (if any)
  3. Environment (OS)
  4. Source to your app (as much as possible)

... would really help get better answers. The following thread discussing the same under NginX might help you. Please consider revising your question, however, even if this solves your problem.

Tim Post
Great, I was looking for:gcc -Wall -o myfastcgiapp -Lfcgi myfastcgiapp.cWhen i do that I get "ld: warning: directory 'fcgi' following -L not found". Sounds like I dont have the library installed right.
joels
@joels - did you install fastcgi from source, or via your package manager?
Tim Post
Should be a lower case 'l' for linking in libraries.
zdav
I dowloaded the source but I haven't tried make or anything....
joels
the install-sh file tells me no input file specifed and after running configure, then make, I get a bunch of "Nothing to be done for `all'."
joels
@joels - zdav caught my typo. Its `-lfcgi` not `-Lfcgi`, my bad.
Tim Post
the lowercase -lfcgi let it compile but it wont run like the other files. The url says not found.I haven't moved the headers anywhere yet. Should I just move the include folder from the developerkit into /usr/local/include/fcgi?I have no doubt fastcgi is installed and running.
joels
@joels - getting it to compile is basically the scope of this question. If it built, the library is installed correctly. You'd need to post the source if its not behaving as expected, as well as the web server config.
Tim Post
how is -lfcgi working if I dont have a fcgi library installed?
joels
oh i see, os x has it already. nm thanks all
joels