文章來自
安裝LuaJIT,這是個語言,相當於Java-JDK的存在
wget -c http://luajit.org/download/LuaJIT-2.0.4.tar.gz
tar xzvf LuaJIT-2.0.4.tar.gz
cd LuaJIT-2.0.4
make install PREFIX=/usr/local/luajit
# 設置環境變量!
export LUAJIT_LIB=/usr/local/luajit/lib
export LUAJIT_INC=/usr/local/luajit/include/luajit-2.0
可能報錯
報錯nginx: error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: No such file or directory 可以執行
# 具體source的路徑已實際安裝路徑為准
ln -s /usr/local/luajit/lib/libluajit-5.1.so.2 /lib64/libluajit-5.1.so.2
helloword
- 直接命令,也可以用lua文件,這里不展示了
luajit print("helloword")
安裝cjson
wget http://www.kyne.com.au/~mark/software/download/lua-cjson-2.1.0.tar.gz
tar zxvf lua-cjson-2.1.0.tar.gz
cd lua-cjson-2.1.0
vim Makefile
PREFIX = /usr/local/luajit
LUA_INCLUDE_DIR = $(PREFIX)/include/luajit-2.0
make
make install
# 安裝完畢后可以在 路徑下看到有個cjson.so文件