Install Lua in Linux and implement PHP Lua Extension


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 −

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

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 −

extension=lua.so

Updated on: 20-Jul-2021

288 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements