- Installed Lua x86 from here: https://code.google.com/archive/p/luaforwindows/downloads
- Set up LUA_CPATH
- Added to C:/xampp/apache/conf/httpd.conf
LoadModule lua_module modules/mod_lua.so
<Files "*.lua">
SetHandler lua-script
</Files>
<IfModule dir_module>
DirectoryIndex index.lua
</IfModule>
Simple examples work (output to the http client), LuaSQL also works, but only like this: "lua exLuaSQL.lua", but it doesn't work through Apache. Example code:
function handle(r)
r.content_type = "text/html"
r:puts("ok") -- it works
package.cpath = package.cpath .. ";C:/Program Files (x86)/Lua/5.1/lua/luasql/?.dll"
mysql = require "luasql.mysql" -- error here
local env = mysql.mysql()
local conn = env:connect('test','root','','localhost',3306)
cursor,errorString = conn:execute([[select * from myarttable]])
row = cursor:fetch({}, "a")
while row do
print(string.format("id: %s, text: %s, description: %s, keywords: %s", row.id, row.text, row.description, row.keywords))
row = cursor:fetch(row, "a")
end
end
A message is issued: error loading module 'luasql.mysql' from file 'C:\Program Files (x86)\Lua\5.1\clibs\luasql\mysql.dll': %1 is not a Win32 application.
What could be the problem?
Sincerely, Alexei
Perhaps LuaSQL through the Apache module requires compilation 64, but there is no such version of LuaSQL anywhere. Is it possible to compile such a version yourself? Are there sources for W64?