We can use PEAR to process zip files in PHP using Archive_Zip….

First set PEAR path in php include path using set_include_path

Make Zipped file

include (‘Archive/Zip.php’);        // include PEAR ZIP package

$obj = new Archive_Zip(‘test.zip’);  // zipped file name

$files = array(‘phpsolutions/1.gif’,
phpsolutions/invoice.xls’);   // files add to zip

if ($obj->create($files)) {
echo ‘Files zipped successfully!';
} else {
echo ‘Error in file zipping';
List Zip file elements

include (‘Archive/Zip.php’);        // include PEAR ZIP package

$obj = new Archive_Zip(‘test.zip’); // Input zip file

$files = $obj->listContent();       // zip information

foreach ($files as $f) {
foreach ($f as $s => $v) {
echo “$s: $v\r\n”;
echo “\r\n”;
I really enjoyed programming with PEAR…

17 Responses to Create ZIP archives with PHP script and PEAR class

  1. tramadol says:

    I’ve recently started a blog, the data you provide here has helped me tremendously. Appreciation for all of your time & work…

  2. Anonymous says:

    Hi I discovered this site by mistake while i was searching yahoo with this issue, I must say your site is really helpful Furthermore , i love the theme, its amazing!. I dont have much time and energy to read your post at the moment but I’ve bookmarked it and as well subscribed to your RSS feeds. I’ll be last a day or two. many thanks an excellent site.

  3. Anonymous says:

    Wow, that’s an extremely nice read!

  4. Anonymous says:

    Thank you for sharing superb informations. Your websiteis so cool.I’m thankful for the details that you’ve with this blog. It reveals how nicely someone perceives this subject. Bookmarked this site, arrive backfor extra articles. You, my mate, ROCK! I ran across this can be the info I already searched in all places and just couldn?t run into. Such a ideal website. I love this web web site as well as your website will probably be certainly one of my new favorite ones.I favor this fabulous website given and has now given me some form of dedication to achieve success for a few purpose, so thanks

  5. Dian Sayres says:

    Hello there, I found your blog by the use of Google at the same time as searching for a related topic, your web site came up, it appears to be like great. I’ve bookmarked it in my google bookmarks.

  6. Anonymous says:

    This is really interesting, You are a very skilled blogger. I’ve joined your feed and look forward to seeking more of your wonderful post. Also, I have shared your website in my social networks!

  7. Tammi Windle says:

    Great ideas, thanks are in order for taking the time to put it up

  8. Anonymous says:

    I lastly determined to create a comment on your weblog. I just wanted to say very ripe position . I truly take pleasure in learning your posts.

  9. brgrgb says:

    I have seen loads of useful elements on your web site about pc’s. However, I’ve the opinion that notebook computers are still more or less not powerful adequately to be a good choice if you typically do jobs that require a great deal of power, like video touch-ups. But for internet surfing, statement processing, and the majority of other prevalent computer work they are fine, provided you don’t mind the tiny screen size. Many thanks sharing your thinking.

  10. IRS Attorney says:

    fantastic put up, very informative. I’m wondering why the other experts of this sector do not understand this. You must continue your writing. I am sure, you’ve a great readers’ base already!

  11. Anonymous says:

    Very nice post. I simply stumbled upon your blog and wanted to say that I’ve really loved surfing around your weblog posts. In any case I will be subscribing to your feed and I am hoping you write again very soon!

  12. Modesta Wigren says:

    I am forever thought about this, appreciate it for putting up.

  13. Anonymous says:

    I am extremely inspired together with your writing abilities well with the layout in your blog. Is this a paid theme or did you customize it yourself? Anyway keep up the excellent quality writing, it’s uncommon to look a great blog like this one nowadays..

  14. Alec McCardell says:

    Nice website you got here. Helped me out a bunch. I have a few questions though, is there anybody I could contact to answer them here? I could use a few opinions.

  15. IRS Garnishment says:

    Hi my loved one! I want to say that this post is awesome, great written and come with approximately all important infos. I would like to peer extra posts like this .

  16. clarinetto says:

    Hello, this is a great blog!

Leave a Reply