Skip to Content

develCuy's blog

by Fernando Paredes García


Lua

The birth of Ophal project

I were very frustrated with PHP in my very beginnings doing web development (8 years to date). But 2 years ago discovered my favorite programming language: Lua, and then decided to start the Nutria project. For more than a year I have tried several ways to "port" my web knowledge to Lua, and finally two months ago decided to do use my new Lua skills for real world web development.

And the result is: "Ophal... a highly scalable web platform, easy to maintain and extend. It is not married with a particular technology, just the essence will be kept on any major change needed to achieve its mission". Let me remark that Ophal has many influences, but the highest comes from Drupal, more will be elaborated about it in the future. Also, I'm giving a lot of credit to Lua, but LuaJIT is the actual compiler used behind scenes.


Playing with LuaJIT FFI

Lua was for long time one of the fastest programming languages, and perhaps sounds new to you but it is older than PHP. LuaJIT has emerged as an improved implementation that can make V8 look like a turtle.


HOWTO phplua + PHP 5.2 on Ubuntu

Lua is an embeddable scripting language. If you are trying to embed it in PHP follow this instructions that may help you:

$ sudo apt-get install phpize liblua5.1-0-dev 
$ git clone git://repo.or.cz/phplua.git src
$ cd src/
$ phpize
$ ./configure

At this point you are almost done, BUT please edit the file Makefile and change the line:

LUA_SHARED_LIBADD = -llua

by:

LUA_SHARED_LIBADD = -llua5.1

Then is time to finish cooking:

$ make
$ sudo make install

Almost done, do a test:

<

pre>
$ make tests #all will fail, that is fine by now


HOWTO Apache 2 + Lua 5.1 + FastCGI in Ubuntu

Install basement

$ sudo apt-get install apache2-mpm-worker liblua5.1-0-dev
$ sudo apt-get install libfcgi-dev libapache2-mod-fcgid

Install Luarocks

Download latest version from: http://luarocks.org/releases/, extract it, open a terminal and do a "cd" into its directory, then:

$ ./configure --with-lua-include=/usr/include/lua5.1/
$ make
$ sudo make install

Install WSAPI

$ sudo luarocks install wsapi-fcgi

Configure Apache



Syndicate content