Please explain how to create PHP's Phar stubs
To answer my own question.
The method outlined in my question, above, is one correct way to create a phar / phar stub.
The reason why it did not work for me and did work for Mario (see his comment below the question), is because I had Suhosin installed and needed to tweak the settings.
Fixed using the technique outlined here:
To fix, put:
suhosin.executor.include.whitelist="phar"
in /etc/php5/cli/php.ini
you could also do it like this:
bootstrap.php;
<?phpfunction go() { print phpversion() . PHP_EOL; print 'i am some script' . PHP_EOL;}
then:
php -r "require 'phar://Myproject.phar'; go();"
or don't have a function and it will execute whatever commands you have in there, but typically you would have some functions or class files in the phar.