Re: using phar and compression

From: Date: Thu, 09 Aug 2012 07:23:18 +0000
Subject: Re: using phar and compression
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-318656@lists.php.net to get a copy of this message
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@gmail.com> To: "Hajo Locke" <hajo.locke@gmx.de> Sent: Wednesday, August 08, 2012 1:32 PM Subject: Re: [PHP] 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@gmx.de>:
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


« previous php.general (#318656) next »