PHP 5.3.1 PHAR outputting readable chars
Posted: Wed Apr 21, 2010 11:48 pm
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" nothing fancy.
using :
Ubuntu9.10
PHP 5.3.1 (using the xampp stack)
here's the code for index.php
here the code I use to create the phar (create.php)
I execute it 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 executer
-> 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 does not work. I also added the httpd.conf setting to parse .phar as .php and re-tried, same results.
Anyone has an idea what wrong am I doing ? or is theres a bug in the code.
Note : I have also tried removeing the error reporting and display errors code, no success
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" nothing fancy.
using :
Ubuntu9.10
PHP 5.3.1 (using the xampp stack)
here's the code for index.php
Code: Select all
<?php
echo "Hello World";
?>
Code: Select all
<?php
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");
?>
-> 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 executer
-> 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 does not work. I also added the httpd.conf setting to parse .phar as .php and re-tried, same results.
Anyone has an idea what wrong am I doing ? or is theres a bug in the code.
Note : I have also tried removeing the error reporting and display errors code, no success