Apache 2.4.4(mod_luaモジュールが付属しています)をダウンロードしてインストールしました。次のように有効にしました。
--httpd.conf--
LoadModule lua_module modules/mod_lua.so
AddHandler lua-script .lua
簡単なスクリプトを実行すると、機能します。
--htdocs / hello.lua--
function handle(r)
r.content_type = "text/html"
r:puts("Hello Lua World!\n")
end
ローカルのpgデータベースに接続したいのですが、動作しません。
function handle(r)
r.content_type = "text/html"
r:puts("Hello Lua World!\n")
local db, err = r:dbacquire("postgres", "postgres://user:secret@localhost/db0")
if not err then
r:puts("connected!")
else
r:puts("couldn't connect!")
end
end
エラーメッセージは一切ありません。それ以上の構成がありませんか?
ご入力いただきありがとうございます。