Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Module socket not found lua

Tags:

nginx

redis

lua

I am trying to use Lua to access Redis values from nginx. When I execute Lua files on the command line, I can read and write values to Redis. But when I try to execute the same files from nginx by accessing a location in which the access_by_lua directive is written, the following errors are logged in the error log file

no field package.preload['socket'] 
no file '/home/sivag/redis/redis-lua/src/socket.lua'
no file 'src/socket.lua'
no file '/home/sivag/lua/socket.lua'
no file '/opt/openresty/lualib/socket.so'
no file './socket.so'
no file '/usr/local/lib/lua/5.1/socket.so'
no file '/opt/openresty/luajit/lib/lua/5.1/socket.so'
no file '/usr/local/lib/lua/5.1/loadall.so'

What is the reason for this and how can I resolve this?

like image 353
Siva Kumar Avatar asked Jul 31 '26 23:07

Siva Kumar


1 Answers

In my case I just needed to install the lua-socket package, as the socket library is not built into the default Lua installation like it is in some other languages.

like image 189
deltaray Avatar answered Aug 03 '26 13:08

deltaray



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!