I've created my first phar archive with the following code:
$phar = new Phar('myphar.phar');
$phar->addFile("index.php");
$phar->setStub($phar->createDefaultStub('index.php', 'index.php'));
The mentioned index.php only does a single output:
echo "I am in a PHP archive!";
When I run the above code, myphar.phar is created and when I run in at the cli, the output is "I am in a PHP archive!".
However, when I call the myphar.phar from a webbrowser, it prints some weird characters, like ????�???�?
, instead of my index.php contents and no error.
I added the following line to my apache httpd.conf to support phar archives:
AddType application/x-httpd-php .phar
Does anybody know why it works on the cli, but not in the browser?