Skip to main content

Fun with PECL Zip 1.6 - Installation

With PECL Zip you can read, add, delete, set and read archive comment, it's a very useful package for searching and managing Zipped archive kind of data.
let's begin with the installation
fire up your PECL installer to install Zip; you'll see some information verbosed while installed PECL Zip like the following

wget && tar -zxvf zip && cd zip-1.6.0/ && phpize5 && sudo ./configure && sudo make && sudo make install

During the installation you will be flooded with verbosed information ; it's useful to watch and try to understand what's going behind the scene; keep your eye on the verbose to see if any error popup like missing library or permission problem, if the installation went fine; at the end you will see

Installing shared extensions: /usr/lib/php5/20050922/

Now let's edit php.ini

sudo vim /etc/php5/apache2/php.ini

and add
now you will only need to restart apache to get the new extension loaded

sudo /etc/init.d/apache2 restart

Now ZIP extension are installed so let's explore the examples directory where you will see PHP code example of how to use ZIP extension
First let's see what methods ZIP class have

< ?php
$Zip = New ZipArchive();
print '

This will output

Array (
[0] => open [1] => close
[2] => addFromString [3] => addFile
[4] => renameIndex [5] => renameName
[6] => setArchiveComment [7] => getArchiveComment
[8] => setCommentIndex [9] => setCommentName
[10] => getCommentIndex [11] => getCommentName
[12] => deleteIndex [13] => deleteName
[14] => statName [15] => statIndex
[16] => locateName [17] => getNameIndex
[18] => unchangeArchive [19] => unchangeAll
[20] => unchangeIndex [21] => unchangeName
[22] => extractTo [23] => getFromName
[24] => getFromIndex [25] => getStream )

Most of methods and functions are being used in the example folder of Zip extention

comment.php create.php dir.php extractAll.php extract.php fopen.php get_set_comments.php odt.php oldapi.php too.php


  1. PECL Zip page

  2. Zip documentation at

  3. PECL Zip - new features announcement

[tags] PHP, PECL, Zip [/tags]


  1. That was really cool :)

  2. You don't need zzlib to install pecl/zip, neither with the upcoming PHP 5.2.0. The extension does not use any external library :)

  3. Thanks for correction dude, I must were drunk while compiling it :D


Post a Comment

Popular posts from this blog

اهم التطورات العلمية في العام ٢٠١٩

القضاء: لا دليل على أن مقتحمي الكونغرس خططوا لقتل مشرعين

أكد محققو وزارة العدل الأمريكية أنهم لم يجدوا حتى الآن أي دليل على أن أنصار دونالد ترامب الذين هاجموا مبنى الكونغرس الأسبوع الماضي خططوا لاحتجاز مسؤولين منتخبين وقتلهم. يأتي ذلك في الوقت الذي أُوقفت فيه الشرطة، الجمعة، رجلا مسلّحا في واشنطن خلال محاولته عبور إحدى نقاط التفتيش في محيط مبنى الكونغرس حيث ستقام الأربعاء مراسم تنصيب جو بايدن. في ذات الوقت أفادت شبكة NBC الأمريكية، بأن مكتب التحقيقات الفيدرالي يحقق في إمكانية تمويل حكومات أو جماعات اقتحام مبنى الكونغرس. وقالت مصادر للشبكة: "المكتب يحقق في مدفوعات "بيتكوين" بقيمة 500 ألف دولار، يبدو أنه تم تحويلها من قبل مواطن فرنسي، لشخصيات ومجموعات رئيسية يمينية قبل اندلاع أعمال الشغب". وفي جلسة استماع في محكمة أريزونا بشأن اعتقال أحد مثيري الشغب جاكوب تشانسلي الذي يؤمن بنظرية المؤامرة ومن أتباع الحركة اليمينية المتطرفة "كيو-آنون"، تراجع المدعون الفيدراليون عن اتهامات سابقة بأن أنصار ترامب كانوا يخططون "لاحتجاز مسؤولين منتخبين وقتلهم" في هجوم السادس من كانون الثاني/ يناير في واشنطن. ع

Saddam's novel to be published next week

AMMAN, Jordan: Saddam Hussein's family will publish next week a novel written by the ousted Iraqi leader before the US-led war on Iraq, his daughter said on Friday. "Ekhroj minha ya mal'un" whose title could be translated into "Get out, damned one" tells the story of a man called Ezekiel who plots to overthrow a town's sheik, but is defeated in his quest by the sheik's daughter and an Arab warrior. The story is apparently a metaphor for a Zionist-Christian plot against Arabs and Muslims. Ezekiel is meant to symbolize the Jews. Raghad Saddam Hussein said her father finished the novel on March 18, 2003 -- a day before the US-led war on Iraq began -- and had expressed a wish to publish the book under his name. The three other novels he wrote were simply signed "Its author." "It was my father's will to publish this book," Raghad said in a telephone interview. Read more An Iraqi artist designed the book's cover, she said, and a