How to run the cgi program

I am new to cgi and with an example I wrote a small program in C ++ that I compiled into a file .cgi.

My question is: do I need a separate web server? I have lighttpd as my default web server ... If I can run the thought of lighttpd, please explain how I can do this ...

+3
source share
2 answers
+2
source

, . , CGI , runCGI.

, , yaml, :

_exec: /var/cgi-bin/myfile.cgi
method: GET
query_string:
  q: s

./runCGI myyamlfile.yaml

.

gdb, debug runCGI gdb runCGI, (run someyaml.yaml), tcatch exec (tcatch ), CGI :

$ g++ a.cc -o a.out
$ cat a.yaml
method: GET
_exec: a.out
$ gdb runCGI
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu"...
(gdb) tcatch exec
Catchpoint 1 (exec)
(gdb) run a.yaml
Starting program: /home/elazar/runCGI/runCGI a.yaml
Executing new program: /home/elazar/runCGI/a.out
0x00007fc3a24a6a60 in ?? () from /lib64/ld-linux-x86-64.so.2
(gdb) tbreak main
Breakpoint 2 at 0x400577: file a.cc, line 2.
(gdb) c
Continuing.
main (argc=1, argv=0x7fff14891408) at a.cc:2
2       int a =0;
(gdb)
0

Source: https://habr.com/ru/post/1794013/


All Articles