Install Lua in Linux and implement PHP Lua Extension

LuaServer Side ProgrammingProgramming

There are cases where we would like to implement PHP Lua extension in PHP.ini so that we can make use of Lua as an embedding language for our PHP code.

It can be done with some series of steps that need to be run in a specific manner and the most important of them is running the --with-lua-version command.

The steps for installing Lua in Linux are −

pecl download lua
cd lua-2.0.7

In the steps above we made use of the pecl which stands for PHP extension community library to download lua and then we are relocating to the lua directory. Now, it’s time to configure lua before we finally add it inside the PHP.ini as an extension.

Consider the steps shown below −

./configure --with-lua-version=5.3
cp modules/ /usr/lib/php/20151012/

The above steps will be enough to configure Lua in PHP, now one more step is left and that is to add Lua as an extension.

Consider the step shown below −
Updated on 20-Jul-2021 13:42:01