Skip to main content

Quick Tip: Install Recki-CT into a Vagrant Ubuntu Box

By Bruno Skvorc

Recki what?

If you don’t know what Recki-CT is, see @ircmaxell’s original post or the repo, we won’t go into depth here. This quick tip will merely show you how to install it on a Homestead Improved box, much like we did with other software before.

Step 1 – Homestead Improved

First and foremost, get a Homestead Improved instance up and running.

Give it a new virtual host like so:

- map:
  to: /home/vagrant/Code/recki

Boot the VM and vagrant ssh into it.

Step 2 – JitFu

Recki-CT needs JitFu to be installed.

As per instructions, run the following commands in order while you’re in the VM.

sudo apt-get install bison flex texinfo

git clone git:// libijt-fu
cd libjit-fu
./configure --prefix=/opt
sudo make install

git clone
cd jitfu
./configure --with-jitfu=/opt
sudo make install

sudo su
echo "" >> /etc/php5/fpm/conf.d/20-jitfu.ini
echo "" >> /etc/php5/cli/conf.d/20-jitfu.ini

sudo service nginx restart
sudo service php5-fpm restart

To see if we installed it successfully:

cd ~/Code
git clone recki
mv recki/public/index.php recki/
touch recki/recki.php

Open recki.php and paste the following content inside it:

use JITFU\Context;
use JITFU\Type;
use JITFU\Signature;
use JITFU\Func;
use JITFU\Value;

$context = new Context();

$integer   = Type::of(Type::int);

$function = new Func($context, new Signature($integer, [$integer]), function($args) use($integer) {
    $zero     = new Value($this, 0, $integer);
    $one      = new Value($this, 1, $integer);
    $two      = new Value($this, 2, $integer);

    /* if ($arg == 0) return 0; */
        $this->doEq($args[0], $zero),
        function() use ($zero) {

    /* if ($arg == 1) return 1; */
        $this->doEq($args[0], $one),
        function() use($one) {

    /* return $function($arg-1) + $function($arg-2); */
            $this->doCall($this, [$this->doSub($args[0], $one)]),
            $this->doCall($this, [$this->doSub($args[0], $two)]))); 


var_dump($function(40)); /* __invoke with magicalness */

If you go to now, you should see JitFu support enabled in the PHPInfo screen. If you go to, you should get int 102334155 as output rather quickly.

Step 3 – Clone and Compose

Next up, we’ll need to clone the Recki repo, and download dependencies with Composer.

cd ~/Code
rm -rf recki
git clone recki
cd recki
composer install

Step 4 – Test

To see if it works, just run the examples via the command line:

php examples/01-basic-usage.php

or through the browser:

That’s all there is to it. Now you can focus on brutal optimizations of your PHP code in certain parts without having to replace the entire PHP engine your app is spinning on.

Bruno is a blockchain developer and technical educator at the Web3 Foundation, the foundation that's building the next generation of the free people's internet. He runs two newsletters you should subscribe to if you're interested in Web3.0: Dot Leap covers ecosystem and tech development of Web3, and NFT Review covers the evolution of the non-fungible token (digital collectibles) ecosystem inside this emerging new web. His current passion project is, the most advanced NFT system in the world, which allows NFTs to own other NFTs, NFTs to react to emotion, NFTs to be governed democratically, and NFTs to be multiple things at once.

Integromat Tower Ad