Forum

c/c++ cgi

Rahul
18 April 2011, 09:16


Hiawatha version: 7.4
Operating System: debian

Hi, can you please explain how can i configure my C-cgi application. Its a simple cgi application not fast-cgi.


Hugo Leisink
18 April 2011, 09:29
Compile your application, give it the extension .cgi and place it in the webroot directory. The following settings should be present in hiawatha.conf:
CGIextension = cgi

VirtualHost {
...
ExecuteCGI = yes
}

That's it.
Rahul
19 April 2011, 14:03
ok...and what should i write in URL to execute my C-cgi application?
Hugo Leisink
19 April 2011, 15:50
The name of the application. If you compile your application and rename the binary to, for example, app.cgi, you can call that application via http://www.yourwebsite.com/app.cgi. Of course, don't forget to copy app.cgi to the webroot of your website.
Rahul
20 April 2011, 11:45
When i try to execute my C-cgi application, i got an error that is Error - 500, Internal server error while at command line it executes successfully. Help....
Hugo Leisink
20 April 2011, 11:51
What is the output of your CGI application and what does the error logfile say? Is your output CGI-compliant?
Rahul
20 April 2011, 12:00
Error log file says that "abc.cgi | Permission denied". My CGI application simply takes input parameters from environment variable QUERY_STRING, do some manipulation and show result on standard output using printf.
Rahul
20 April 2011, 12:22
Also error log file says:
Sat 05 Feb 2011 11:50:13 -0500|10.112.63.166|/usr/local/var/www/hiawatha/param_parser.cgi|execute CGI: Permission denied
Sat 05 Feb 2011 11:50:13 -0500|10.112.63.166|/usr/local/var/www/hiawatha/param_parser.cgi|no output
Hugo Leisink
20 April 2011, 13:28
In that case, give your param_parser.cgi the execution bit: chmod 755 param_parser.cgi.

The 'no output' means that your application didn't have any... well... output. Every CGI application should at least print a CGI header. Do you have a line in your application's source code that looks like this?
printf("Content-Type: text/html\r\n\r\n");
Rahul
21 April 2011, 07:40
Thanks...now its working...but when i set parameters for wrap cgi i got an error "403-Forbidden". Also error log file says "Mon 07 Feb 2011 08:14:37 -0500|10.112.63.166|/usr/local/var/www/hiawatha/param_parser.cgi|CGI-wrapper: no valid Wrap found".

My configuration for cgi-wrapper.conf file is
Wrap = wrap_id:/usr/local/var/www/hiawatha:nobody

and for hiawatha.conf is
WrapCGI =wrap_id
CGIwrapper = /home/rahul/hiawatha-7.4/cgi-wrapper

Hugo Leisink
21 April 2011, 08:47
In cgi-wrapper.conf, replace the colons by semicolons:
Wrap = wrap_id ; /usr/local/var/www/hiawatha ; nobody
Rahul
21 April 2011, 09:13
In cgi-wrapper.conf, i replace the colons by semicolons but the error remains same.
This topic has been closed.