lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

I am trying to run test.lp from the example folder of CGIlua.

Having downloaded cgilua from Luarocks, I found the following content:


I moved the all content in each folder to the respective position in /usr. The directory /usr/lib/lua/5.1 didn't not exist. So I created it.

I moved also the example folder to /usr/lib/cgi-bin and I give 755 permission for all.

I try:


"500: internal server error"

Reading the specific instructions for Apache, I understood that cgilua.cgi should be in /usr/lib/cgi-bin. I did it. The result is 500 error.

So I remember Apache has two important folders:


I placed test.lp /var/www. The content is shown, but also all its code without any interpretation.

I placed cgilua.lcgi in /var/www. The result was the same.

In test.lp I always made sure that "#!" points to the cgilua.cgi location.

I could not understand. Running CGI with Pascal, it's sufficient to place cgi module in /usr/lib/cgi-bin and call something like: http://localhost/cgi-bin/test.cgi.

As Lua is an interpreted language, I don't know if the procedure is the same.

Well, perhaps the first "hello world" is a little bit more complicated than we would like.

Sorry for asking so much.

Em 17-10-2011 12:06, Peng Zhicheng escreveu:
于 2011-10-17 21:22, Luciano de Souza 写道:
Step by step, let me describe what I could understand.


But how to connect "name", the Lua variable and "name", the HTML variable?

the cgilua would handle the varibles for you, then you can access them
from cgilua.GET and cgilua.POST table, depending how the data are committed.
see the documents and examples.

the examples from the cgilua codebase is very short and comprehensive,
you should check it.

a short description here:
the login.lp page contains forms of username and pass,
and the check.lua script checks them for validation,
and redirects to another page on success, or otherwise
re-display login.lp again with the username already filled.

Note though, the login.lp has a small error: the `action' attribute of the form
should point to the URL of "check.lua" script, which SHOULD be run
by the web server as a CGI program if properly configured. you might need to
insert a `shebang line' pointing to a lua interpretor.

[1] login.lp : [2] check.lua: