Re: [PHP] using phar and compression

2012-08-09 Thread Hajo Locke

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" 

To: "Hajo Locke" 
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 :

Hello,

i do some tests with phar. I have following script which is just adding 
some

file and index.php is echoing "hello";

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



[PHP] using phar and compression

2012-08-08 Thread Hajo Locke

Hello,

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


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