作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经下载并安装了 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
没有任何错误信息。我是否缺少进一步的配置?
感谢任何输入!
最佳答案
Apache httpd 基于APR提供数据库连接;因此请确保您的 APR 安装支持您要使用的数据库层。
关于apache - 无法从 mod_lua 连接到 postgresql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15207968/
我已经下载并安装了 Apache 2.4.4(现在带有 mod_lua 模块)。像这样启用它: --httpd.conf-- LoadModule lua_module modules/mod_lua
如何配置 mod_lua 使用 LuaJIT ,而不仅仅是普通的 Lua ? 最佳答案 我能够像这样编译 Apache 2.3 并将 mod_lua 链接到 LuaJIT 2.0b6: LUA_LIB
我正在尝试为 Apache 设置 mod_lua 模块,但在访问第三方 Lua 模块时遇到了困难。假设我在 Apache 的 htdocs 文件夹中有一个 hello_world.lua,它有这样的东
我是一名优秀的程序员,十分优秀!