Run COBOL using Apache Server
COBOL compiled to an EXE in windows can be placed in Apache cgi-bin folder or any other folder where ExecCGI is enabled
Enable CGI module in Apache
LoadModule cgi_module modules/mod_cgi.so
Write COBOL code "gnucobolcgi.cob"
identification division.
program-id. gnucobolcgi.
environment division.
input-output section.
data division.
working-storage section.
01 newline pic x value x'0a'.
procedure division.
display
"Content-type: text/html"
newline
end-display
display
"Hello From <b>COBOL</b>"
end-display
goback.
end program gnucobolcgi.
Compile gnuCOBOL
$ cobc -x gnucobolcgi.cob
Copy the "gnucobolcgi.exe" to cgi-bin folder
Load the URL in any browser
http:// localhost /cgi-bin /gnucobolcgi.exe
HTML Output in your browser
Hello From COBOL