View Full Version : Lua 5.1.2 on Apache 2.2.11, with PHP 5.2.8 and mySQL 5.1.30
Mikhail
01-01-2009, 02:20 PM
A painless pre-installed and ready to use pack of Apache 2.2.11, Lua 5.1.2, PHP 5.2.8 and mySQL 5.1.30.
- no messing with config files or services under any Win32 environment
- works fine in pendrives.
- only 4.63MB
Download:
Apache_2.2.11.0_+_PHP_5.2.8_+_mySQL_5.1.30_+_PHPMi niAdmin_+_Lua_5.1.2_+_Kepler.zip (http://www.esnips.com/nsdoc/7b4e0a78-1619-427d-96e8-0964b8f2dc42/?action=forceDL)
Details in Portuguese:
WAMP com Lua instalada: apache + lua (+ kepler) + php + mysql, para windows - download (http://xoopscube.com.br/2008/12/apache-lua-php-mysql-kepler-windows.php)
[]'s,
Mikhail Miguel
reteset
01-03-2009, 10:04 AM
what does this , could you explain :)
or this runs a lua script on web server..?
Mikhail
01-03-2009, 10:24 AM
what does this , could you explain :)
Hi! This is a WAMP (http://en.wikipedia.org/wiki/WAMP) with Kepler (http://www.keplerproject.org/) and LUA CGI (http://www.keplerproject.org/cgilua/manual.html) installed and ready to use.
this runs a lua script on web server..?
Yes, you can run lua scripts (.lua files, 100% lua) and Lua pages (.lp files, HTML with <?lua ?> tags) to crerate dynamic pages like PHP.
Mikhail
01-03-2009, 11:20 AM
Lua Scripts
Lua Scripts are text files containing valid Lua code. This style of usage adopts a more "raw" form of web programming, where a program is responsible for the entire generation of the resulting page. Lua Scripts have a default .lua extension.
To generate a valid web document (HTML, XML, WML, CSS etc) the Lua Script must follow the expected HTTP order to produce its output, first sending the correct headers and then sending the actual document contents.
CGILua offers some functions to ease these tasks, such as cgilua.htmlheader to produce the header for a HTML document and cgilua.put to send the document contents (or part of it).
For example, a HTML document which displays the sentence "Hello World!" can be generated with the following Lua Script:
cgilua.htmlheader()
cgilua.put([[
<html>
<head>
<title>Hello World</title>
</head>
<body>
<strong>Hello World!</strong>
</body>
</html>]])
It should be noted that the above example generates a "fixed" page: even though the page is generated at execution time there is no "variable" information. That means that the very same document could be generated directly with a simple static HTML file. However, Lua Scripts become especially useful when the document contains information which is not known beforehand or changes according to passed parameters, and it is necessary to generate a "dynamic" page.
Another easy example can be shown, this time using a Lua control structure, variables, and the concatenation operator:
cgilua.htmlheader()
if cgilua.QUERY.language == 'english' then
greeting = 'Hello World!'
elseif cgilua.QUERY.language == 'portuguese' then
greeting = 'Olá Mundo!'
else
greeting = '[unknown language]'
end
cgilua.put('<html>')
cgilua.put('<head>')
cgilua.put(' <title>'..greeting..'</title>')
cgilua.put('</head>')
cgilua.put('<body>')
cgilua.put(' <strong>'..greeting..'</strong>')
cgilua.put('</body>')
cgilua.put('</html>')
In the above example the use of cgilua.QUERY.language indicates that language was passed to the Lua Script as a CGILua parameter, coming from the URL used to activate it (via GET). If you were using a form, the parameter would be available in cgilua.POST.language. CGILua automatically decodes such QUERY and POST parameters so you can use them at will on your Lua Scripts and Lua Pages.
Mikhail
01-03-2009, 11:22 AM
Lua Pages
A Lua Page is a text template file which will be processed by CGILua before the HTTP server sends it to the client. CGILua does not process the text itself but look for some special markups that include Lua code into the file. After all those markups are processed and merged with the template file, the results are sent to the client.
Lua Pages have a default .lp extension. They are a simpler way to make a dynamic page because there is no need to send the HTTP headers. Usually Lua Pages are HTML pages so CGILua sends the HTML header automatically.
Since there are some restrictions on the uses of HTTP headers sometimes a Lua Script will have to be used instead of a Lua Page.
The fundamental Lua Page markups are:
<?lua chunk ?>
Processes and merges the Lua chunk execution results where the markup is located in the template. The alternative form <% chunk %> can also be used.
<?lua= expression ?>
Processes and merges the Lua expression evaluation where the markup is located in the template. The alternative form <%= expression %> can also be used.
Note that the ending mark could not appear inside a Lua chunk or Lua expression even inside quotes. The Lua Pages pre-processor just makes global substitutions on the template, searching for a matching pair of markups and generating the corresponding Lua code to achieve the same result as the equivalent Lua Script.
The second example on the previous section could be written using a Lua Page like:
<html>
<?lua
if cgilua.QUERY.language == 'english' then
greeting = 'Hello World!'
elseif cgilua.QUERY.language == 'portuguese' then
greeting = 'Olá Mundo!'
else
greeting = '[unknown language]'
end
?>
<head>
<title><%= greeting %></title>
</head>
<body>
<strong><%= greeting %></strong>
</body>
</html>
HTML tags and Lua Page tags can be freely intermixed. However, as on other template languages, it's considered a best practice to not use explicit Lua logic on templates. The recommended aproach is to use only function calls that returns content chunks, so in this example, assuming that function getGreeting was definied in file functions.lua as follows:
function getGreeting()
local greeting
if cgilua.QUERY.language == 'english' then
greeting = 'Hello World!'
elseif cgilua.QUERY.language == 'portuguese' then
greeting = 'Olá Mundo!'
else
greeting = '[unknown language]'
end
return greeting
end
the Lua Page could be rewriten as:
<?lua
assert (loadfile"functions.lua")()
?>
<html>
<head>
<title><%= getGreeting() %></title>
</head>
<body>
<strong><%= getGreeting() %></strong>
</body>
</html>
Another interesting feature of Lua Pages is the intermixing of Lua and HTML. It is very usual to have a list of values in a table, iterate over the list and show the items on the page.
A Lua Script could do that using a loop like:
cgilua.put("<ul>")
for i, item in ipairs(list) do
cgilua.put("<li>"..item.."</li>")
end
cgilua.put("</ul>")
The equivalent loop in Lua Page would be:
<ul>
<% for i, item in ipairs(list) do %>
<li><%= item %></li>
<% end %>
</ul>
Imagine Programming
01-03-2009, 12:11 PM
That is looking good. Thanks for this great lesson.
Mikhail
01-24-2011, 03:32 PM
Updated:
http://underpop.free.fr/x/xoopserver/xoopserver.zip
# Size: only 5,93 MB (6.220.709 bytes)
# Apache/2.2.17 (Win32)
# Lua/5.1 (just for testing)
# MySQL/5.5.8 (user: root, password: blank)
# PHP/5.3.4
Notes:
- All old/ugly icons used by Apache was replaced: \usr\share\apache\icons\
- Lua was not very well installed and will be removed from the next version.
- PhpMyAdmin was replaced by Adminer 3.0.1 < http://127.0.0.1/mysqladmin/ >
- Compressed with WinRK
[]'s,
Mikhail Miguel
MadDogDean
01-25-2011, 05:24 AM
Mikhail,
Is this like the XAMPP release from the folks in Germany? I don't know anything about it (Lua on the web) yet (apart from a brief explanation by IP/Bas), but I imagine that having Lua installed on a local web server in this way would be good for testing Lua web code?
Cheers,
dean
Updated:
http://underpop.free.fr/x/xoopserver/xoopserver.zip
# Size: only 5,93 MB (6.220.709 bytes)
# Apache/2.2.17 (Win32)
# Lua/5.1 (just for testing)
# MySQL/5.5.8 (user: root, password: blank)
# PHP/5.3.4
Notes:
- All old/ugly icons used by Apache was replaced: \usr\share\apache\icons\
- Lua was not very well installed and will be removed from the next version.
- PhpMyAdmin was replaced by Adminer 3.0.1 < http://127.0.0.1/mysqladmin/ >
- Compressed with WinRK
[]'s,
Mikhail Miguel
Your new download triggers Avast to be a malware a file with _sfx that is the problem.
azmanar
03-24-2011, 05:23 PM
Hi,
I have 2 important questions:
->> Is the latest Apache in Web Hosting providers have mod_lua installed?
->> Do you know any dynamic sample sites fully run with LUA & MySQL?
Imagine Programming
03-27-2011, 08:40 AM
Hi,
I have 2 important questions:
->> Is the latest Apache in Web Hosting providers have mod_lua installed?
->> Do you know any dynamic sample sites fully run with LUA & MySQL?
1) No, but I think they are thinking about including it by default.
2) No, but there are a few I think. You could mask out the *.lua by using the .htaccess (mod_rewrite), so there might be quite a few.
Still flagging a AV wonting dude can you rename or compress another way so my AV want stop the download it lol thanks man.
Sakuya
03-28-2011, 12:40 AM
Still flagging a AV wonting dude can you rename or compress another way so my AV want stop the download it lol thanks man.
Since I don't use an anti-virus (too hardcore) I decompressed and re-archived using WinRAR.
http://shadiku.com/tmp/xoopserver.rar
Have fun.
That did the trick thanks man.
Powered by vBulletin™ Version 4.0.6 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.