back to coding
CGI - Common Gateway Interface
This connects a web server such as Apache to an external program, like one written in lua, perl, python or shell script.
When the program is run, several environment variables are set to pass along to the program.
The program should write out to standard output the headers and then the contents of the page.
I wrote a script in lua to take apart the environment variables and set them to lua tables so it's easier to program.
This is at cgi.lua.
Instead of CGI it's possible to run with a language built into the web server like PHP or asp.net. This is said to be more efficient.
There is also something called Fast CGI which has one program that can take several requests over sockets instead of one program per request using environment variables.
Maybe I'll learn Fast CGI one day.
Or I was looking at apache mod_lua, I don't think that one is too bad! Aside from being "unsafe" since you can have lua take over the whole apache.
Kind of seems like a benefit to me.
Making my CGI scripts work with apache's mod_lua instead of my cgilua53 script wouldn't actually be that different.