Re: using phar and compression

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

thanks, but i cant do this.
its just this problem: Should line
$compressed = $phar->convertToExecutable(Phar::TAR,Phar::GZ, '.phar.tgz');
create a ready to run executable or not .Its not about creating phar archives in optional way.
It is a special problem i try to find...

Thanks,
Hajo

----- Original Message ----- From: "Alan Hoffmeister" <alanhoffmeister@xxxxxxxxx>
To: "Hajo Locke" <hajo.locke@xxxxxx>
Sent: Wednesday, August 08, 2012 1:32 PM
Subject: Re:  using phar and compression


Why don't you use Phar::compress() instead of
Phar::convertToExecutable() and see what happens?
http://php.net/manual/en/phar.compress.php

--
Att,
Alan Hoffmeister


2012/8/8 Hajo Locke <hajo.locke@xxxxxx>:
Hello,

i do some tests with phar. I have following script which is just adding some
file and index.php is echoing "hello";

<?php
$phar = new Phar('project.phar', 0, 'project.phar');
$phar->buildFromDirectory(dirname(__FILE__) . '/web');
$phar->setStub($phar->createDefaultStub('index.php'));
$compressed = $phar->convertToExecutable(Phar::PHAR,Phar::GZ, '.phar.tgz');
?>

This is working and i can call resulting by: "php project.phar"
Now i change last line to:
$compressed = $phar->convertToExecutable(Phar::TAR,Phar::GZ, '.phar.tgz');

Now the final phar archive should be compressed with tar. Creating the
archive works without errors, but i cant run it.
Viewing file project.phar.tgz shows only binary-content, no php-header.
Running "php project.phar.tgz" shows no output.
As i understood i can run any phar archive, regardless of used
compressionmethod. Is this right? Am i using phar the correct way?

Thanks,
Hajo

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux