Book Image

Lighttpd

By : Andre Bogus
Book Image

Lighttpd

By: Andre Bogus

Overview of this book

Table of Contents (20 chapters)
Lighttpd
Credits
About the Author
About the Reviewer
Preface
HTTP Status Codes

Lua/FastCGI


The Lua/FastCGI interface comes as a single C file. It simply embeds the Lua interpreter, binding it to the FastCGI interface, adding a little functionality here and there. The result is that 223 lines of C code create a fully functional FastCGI scripting environment, including a byte code cache, Lighttpd's stat cache and GET and POST processing capabilities.

Installing Lua/FastCGI

We can get it from http://jan.kneschke.de/projects/lua. If we have already installed Lua and FastCGI (refer to Chapter 1, if not); we can compile it using gcc with:

$ gcc -Wall -O2 -g -o magnet magnet.c -lfcgi -llua -lm -ldl -Wl,-E

Note

Why the -Wl,-E? The site says nothing about it?

The -Wl option gives a list of comma-separated options to the linker. The -E linker option can also be written as " export-dynamic" and tells the linker to export all symbols as dynamic. If we omit this option, our Lua scripts will not be able to find any C function, including all the built-in functions! Also be sure to compile...