There are a lot of howto's out there in the web but i recommend the one from php.net.
If you just want to build a phar from existing source, i use the box.
Based on that, i created a simple example you can clone.
The first snare could be the phar.readonly php.ini setting. So check if you set it to "Off".