Aaaand, solved (kinda) after few hours of breaking my head. I still have no idea why, this build script seems to work:
$archiveName = 'phpbenchmark.phar';
$phar = new Phar($archiveName);
$phar->buildFromDirectory(__DIR__, '/\/lib\/|\/vendor\//');
$phar->setStub(createStub());
function createStub()
{
$stub = <<<ENDSTUB
#!/usr/bin/env php
<?php
Phar::mapPhar('phpbenchmark.phar');
require 'phar://phpbenchmark.phar/lib/app.php';
__HALT_COMPILER();
ENDSTUB;
return $stub;
}
Except.....I can't really see any differences to original script posted in my question? Why would original one crash PHP Cli and this one works?