Project

General

Profile

lighttpd for CGI written in C-language(Not working please help)

Added by Maddy over 16 years ago

I have a problem in invoking the CGI-Script written in C-language,

Following are the steps am following.

1) I will compile the C-code which is in the cgi-bin of the server-root, hence the binary is also created in the same folder,
2) using the ip of the machine where the lighttpd is installed am invoking the above binary from the html page like this, "http://10.114.116.121/cgi-bin/cbinary", but here is the problem, this binary is not working at all i tried in many ways, please find the following setting which i maid in the lighttpd for this

Operating System : Linux
Client Browser : Firefox, IE

Module: mod_cgi

  • The CGI-Module
  • Description
  • Options
  • Examples

Description¶

CGI programs allow you to enhance the functionality of the server in a very straight-forward and simple way.
Options¶

cgi.assign

file-extensions that are handled by a CGI program

cgi.assign = ( ".pl"  => "/usr/bin/perl",
".cgi" => "/usr/bin/perl" )

For PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini.

To get the old cgi-bin behavior of apache:

#Note: make sure that mod_alias is loaded if you use this:
alias.url += ( "/cgi-bin" => server_root + "/cgi-bin" )
$HTTP["url"] =~ "^/cgi-bin" {
cgi.assign = ( "" => "" )
}

cgi.execute-all

In 1.5.0 and later you can use: ::

$PHYSICAL["existing-path"] =~ "^/var/www/myvhost/cgi-bin/" {
cgi.execute-all = "enable"
}

which does the same thing as cgi.assign = ("" => "") but is more obvious to use.
Examples¶

To setup an executable which can run on its own (e.g. binaries, scripts with a shebang line) you just don't specify a handler for the extension:

cgi.assign = ( ".sh" => "" )

If the file has no extension keep in mind that lighttpd matches not the extension itself but the right part of the URL:

cgi.assign = ( "/testfile" => "" )

but it is still giving me the same problem,

BUT THE EXPECTED THING IS, that CGI Script should process my request like how the Servlet process in Tomcat, the same application working for the cgi-bin of the Apache web server but not working with lighttpd which are almost same.

Please let me know what all the additional things i should take care to make it work, please help me i have been trying this from past 2 months.

I posted it before but the reply wont help.

There are 2 behaviours am obesrving, when i invoke this binary from mozilla, am putting the response in an alert function so the mozilla alert has the content of the binary itself, which i wrong, and when i try the same from IE it is giving some text like ELF always, please let me know what should i do to make this work for the CGI Script written in C-language ?

for compiling the C-code am using gcc command on Linux, so the binary created out of it wont have any extension, so here am not getting whether lighttpd expect anything other than this, but he same is working with Linux.

Please help me i really appreciate your help.


Replies (1)

RE: lighttpd for CGI written in C-language(Not working please help) - Added by Olaf-van-der-Spek over 16 years ago

What is your CGI-specific conf in Lighttpd?
And just link to the docs, copy/pasting them is useless.

    (1-1/1)