刚编译了最新的1.11.2.5,一切均是默认,无任何定制参数,版本信息如下:
/usr/local/openresty/bin/resty -V
resty 0.19
nginx version: openresty/1.11.2.5
built by gcc 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
built with OpenSSL 1.0.1f 6 Jan 2014
TLS SNI support enabled
configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt=-O2 --add-module=../ngx_devel_kit-0.3.0 --add-module=../echo-nginx-module-0.61 --add-module=../xss-nginx-module-0.05 --add-module=../ngx_coolkit-0.2rc3 --add-module=../set-misc-nginx-module-0.31 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.06 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10.10 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.32 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.18 --add-module=../redis2-nginx-module-0.14 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.14 --add-module=../rds-csv-nginx-module-0.07 --with-ld-opt=-Wl,-rpath,/usr/local/openresty/luajit/lib --with-http_ssl_module
用resty命令行工具确实没有问题,但跑在Nginx里就出错,错还是那样:
lua entry thread aborted: runtime error: error loading module 'cjson.safe' from file '/usr/local/openresty/lualib/cjson.so':
/usr/local/openresty/lualib/cjson.so: undefined symbol:
luaL_setfuncsstack traceback:
coroutine 0:
[C]: in function 'require'
/home/chrono/openresty/service/http/cjson.lua:4: in function </
home/chrono/openresty/service/http/cjson.lua:1>, client: 127.0.0.1, server: localhost, request: "GET /test/cjson HTTP/1.1", host: "127.1"
按理来说resty命令行和自己配置的lua脚本都是一个Nginx,是否是有什么其他的环境变量设置导致的?
在 2017年8月22日星期二 UTC+8上午2:35:13,agentzh写道:
Hello!
2017-08-21 2:10 GMT-07:00 葛美洁:
> openresty/1.11.2.4有相同的问题
>
请尝试升级到最新的 OpenResty 1.11.2.5。
同时确保你使用的是 OpenResty 自带的 lua-cjson,否则会和最新的 LuaJIT 有兼容性问题(见我上一封邮件里的说明)。
Regards,
Yichun