Hello,
I am trying to make a simple PHAR archive work:
here's what I am trying to do : Create a .phar file that simply outputs "Hello world" on execution nothing fancy.
using :
- Ubuntu 9.10
- PHP 5.3.1, Apache 2 (using the xampp stack)
- I have set the phar.readonly to off in the php.ini
- I also added the httpd.conf setting to parse .phar as .php
code for index.php
echo "Hello World";
here the code I use to create the phar (create.php)
Code: Select all
error_reporting(E_ALL);
ini_set('display_errors', 'on');
$phar = new Phar('myphar.phar'); // I have even tried putting this as myphar.phar.php
$phar->addFile("index.php");
I execute the create.php using :
php5.3.1 create.php
Now, above code does create a myphar.phar which is great but when I try to access this file using the command line
php5.3.1 myphar.phar
or even renamed and executed
php5.3.1 myphar.phar.php
it displays "��???" <- some rubbish with boxes and ??? if you cannot see it, same case when using the browser too. renaming to it myphar.phar.php also has no effect.
I also tried setting the stub file and then using the above code and it still does not work.
Anyone has an idea what wrong am I doing ? or is theres a bug in the code.
Note :
1. I have also tried removing the error reporting and display errors code, no success.
2. I have tried to use the 5.3.0 version also but have the same results.