安装版本
# lua -v
Lua 5.3.4 Copyright (C) 1994-2017 Lua.org, PUC-Rio
# apisix version
/usr/local/openresty//luajit/bin/luajit /usr/local/apisix/apisix/cli/apisix.lua version
3.5.0
报错日志:
2024/06/06 13:48:50 [error] 471284#471284: *552203 [lua] plugin.lua:135: load_plugin(): failed to load plugin [sfimplat-auth] err: /usr/local/apisix/apisix/plugins/sfimplat-auth.lua:12: module 'luasql.mysql' not found:
no field package.preload['luasql.mysql']
no file '/usr/local/apisix//deps/share/lua/5.1/luasql/mysql.lua'
no file '/usr/local/apisix//deps/share/lua/5.1/luasql/mysql/init.lua'
no file '/usr/local/apisix/luasql/mysql.lua'
no file '/usr/local/apisix/luasql/mysql/init.lua'
no file '/usr/local/openresty/site/lualib/luasql/mysql.ljbc'
no file '/usr/local/openresty/site/lualib/luasql/mysql/init.ljbc'
no file '/usr/local/openresty/lualib/luasql/mysql.ljbc'
no file '/usr/local/openresty/lualib/luasql/mysql/init.ljbc'
no file '/usr/local/openresty/site/lualib/luasql/mysql.lua'
no file '/usr/local/openresty/site/lualib/luasql/mysql/init.lua'
no file '/usr/local/openresty/lualib/luasql/mysql.lua'
no file '/usr/local/openresty/lualib/luasql/mysql/init.lua'
no file './luasql/mysql.lua'
解决方案
去网上找一个luasql包,注意:无需安装
在目录 /usr/local/apisix/deps/lib/lua/5.1 下创建目录 luasql
然后去 下载的luasql包 里找到文件 mysql.so ,移动至目录 /usr/local/apisix/deps/lib/lua/5.1/luasql 下
# mv mysql.so /usr/local/apisix/deps/lib/lua/5.1/luasql/
报错日志:
2024/06/06 14:23:21 [error] 485285#485285: *688915 [lua] plugin.lua:135: load_plugin(): failed to load plugin [sfimplat-auth] err: error loading module 'luasql.mysql' from file '/usr/local/apisix//deps/lib/lua/5.1/luasql/mysql.so':
libmysqlclient.so.21: cannot open shared object file: No such file or directory, context: init_worker_by_lua*
解决方案:
yum install -y mysql-devel