# Php ZIP function

**URL:** <https://forums.interworx.com/t/php-zip-function/9649>\
**Category:** General Inquries\
**Created:** [April 30, 2005, 3:17pm UTC](https://forums.interworx.com/t/php-zip-function/9649 "2005-04-30T15:17:31Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://forums.interworx.com/uploads/default/original/2X/4/40ab17cc34b792a0172b48ad1333b9ba9299a9a1.png) [@system](https://forums.interworx.com/u/system)\
**Post date:** [April 30, 2005, 3:17pm UTC](https://forums.interworx.com/t/php-zip-function/9649/1 "2005-04-30T15:17:31Z")

</div>

Hello,

I need the ability to manage zip files from PHP.

Do you know the ZIP package to install ?

Do we absolutly have to compile php from source to add something like with-zip=

Thanks for your help

Pascal

---

<div class="post-metadata">

**Author:** ![IWorx-Chris](https://forums.interworx.com/letter_avatar_proxy/v4/letter/i/ba8739/32.png) [@IWorx-Chris](https://forums.interworx.com/u/IWorx-Chris)\
**Post date:** [April 30, 2005, 3:22pm UTC](https://forums.interworx.com/t/php-zip-function/9649/2 "2005-04-30T15:22:52Z")

</div>

You’ll need zip and/or zip-devel most likely Pascal, and you will have to recompile from source. I’d just take the 4.3.11 SRPM and use it as your base, it’ll make the process much easier than doing it from scratch.

Chris

---

<div class="post-metadata">

**Author:** ![system](https://forums.interworx.com/uploads/default/original/2X/4/40ab17cc34b792a0172b48ad1333b9ba9299a9a1.png) [@system](https://forums.interworx.com/u/system)\
**Post date:** [May 1, 2005, 11:11am UTC](https://forums.interworx.com/t/php-zip-function/9649/3 "2005-05-01T11:11:39Z")

</div>

> [@IWorx-Chris](#):
>
> You’ll need zip and/or zip-devel most likely Pascal, and you will have to recompile from source. I’d just take the 4.3.11 SRPM and use it as your base, it’ll make the process much easier than doing it from scratch.
> 
> Chris

Thanks Chris.

The zip and zip-devel may be found in the PECL web site ? I only know the Zziplib. What is the zip-devel ? isn’t it a perl module ?

Also does gzopen couldn’t open a zip file ?

Or is there in PEAR a zip class ? in this case I won’t have to recompile the php as I think it is already compiled with-pear.

And last you’ll be very cool if you could provide me an example or a little howto to take the 4.3.11 SRPM as my base and recompile from it PHP

Thanks

Pascal

---

<div class="post-metadata">

**Author:** ![IWorx-Chris](https://forums.interworx.com/letter_avatar_proxy/v4/letter/i/ba8739/32.png) [@IWorx-Chris](https://forums.interworx.com/u/IWorx-Chris)\
**Post date:** [May 1, 2005, 2:23pm UTC](https://forums.interworx.com/t/php-zip-function/9649/4 "2005-05-01T14:23:33Z")

</div>

Do you need zip access or access to gzopen Pascal? gzopen is part of zlib which is included in the default IWorx-CP RPM.

The zip packages should be installable via YUM (yum install zip).

Get back to me on that 1st point and if you still need the zip functions (not gzopen) I’ll walk you through the recompile.

Chris

---

<div class="post-metadata">

**Author:** ![system](https://forums.interworx.com/uploads/default/original/2X/4/40ab17cc34b792a0172b48ad1333b9ba9299a9a1.png) [@system](https://forums.interworx.com/u/system)\
**Post date:** [May 2, 2005, 3:06am UTC](https://forums.interworx.com/t/php-zip-function/9649/5 "2005-05-02T03:06:02Z")

</div>

It’s the zip not gzopen,  
(but I’ve seen some php classes that read some .zip and .gz using gzopen / zlib files : so I’ve been a little disapointed)

Also maybe it could be more easy to use [http://www.phpconcept.net/pclzip/index.en.php](http://www.phpconcept.net/pclzip/index.en.php) or or the pear zip.php class and not to have to recompile php ?

> 

The zip packages should be installable via YUM (yum install zip).

Hmmm ? are you sure the zip package is the php library ? I already have a zip package installed on my box but I don’t think it is the php one ?

> 

## Looking in Installed Packages: Name Arch Version Repo

zip i386 2.3-16.1 db

Thanks for your help Chris 🙂

Pascal

---

<div class="post-metadata">

**Author:** ![system](https://forums.interworx.com/uploads/default/original/2X/4/40ab17cc34b792a0172b48ad1333b9ba9299a9a1.png) [@system](https://forums.interworx.com/u/system)\
**Post date:** [May 3, 2005, 6:50am UTC](https://forums.interworx.com/t/php-zip-function/9649/6 "2005-05-03T06:50:12Z")

</div>

> 

Get back to me on that 1st point and if you still need the zip functions (not gzopen) I’ll walk you through the recompile.

Ok I have downloaded the zziplib and zziplib-devel,

zziplib-0.13.38-1.1.el3.rf.i386.rpm  
zziplib-devel-0.13.38-1.1.el3.rf.i386.rpm

I"ve found the SDL and SDL-devel package in YUM but not zziplib nor zziplib-devel

now I’m ready to change the php RPM to recompile it with with-zip=

I’ll do this :

> 

rpm -Uvh [http://updates.interworx.info/iworx/SRPMS/php-4.3.11-100.iworx.src.rpm](http://updates.interworx.info/iworx/SRPMS/php-4.3.11-100.iworx.src.rpm)

then update the SPECS file

-to change the Bversion to 101

-to add the with-zip option  
Do I have only to add under the ./configure line  
the option --with-zip= \

I’m not sure if I have to define the directory or not with --with-zip=[dir]  
Indeed I have only these zziplib directory after having installed the rpm

> 

/usr/share/aclocal/zziplib.m4  
/usr/share/zziplib  
/usr/share/zziplib/SDL  
/usr/share/zziplib/SDL/SDL\_rwops\_zzip.c  
/usr/share/zziplib/SDL/SDL\_rwops\_zzip.h  
/usr/include/zziplib.h  
/usr/lib/pkgconfig/zziplib.pc

Which one I have to enter after --with-zip=  
/usr/share/zziplib ?

I imagine that the build action will try to find a C programm ? something like zziplib.c isn’t it ? but I can’t find it

Anyway

then

> 

rpmbuild -bb --with cos3x /usr/src/redhat/SPECS/php.spec

And finally

> 

rpm -Uvh php-4.3.11-101.iworx.src.rpm

do I have also to Upgarde all other php-xxx rpm generated by the rebuild from spec ?

> 

php-devel-4.3.11-100.cos3x.iworx.i386.rpm  
php-domxml-4.3.11-100.cos3x.iworx.i386.rpm  
php-imap-4.3.11-100.cos3x.iworx.i386.rpm  
php-ldap-4.3.11-100.cos3x.iworx.i386.rpm  
php-mbstring-4.3.11-100.cos3x.iworx.i386.rpm  
php-mcrypt-4.3.11-100.cos3x.iworx.i386.rpm  
php-mhash-4.3.11-100.cos3x.iworx.i386.rpm  
php-mysql-4.3.11-100.cos3x.iworx.i386.rpm  
php-ncurses-4.3.11-100.cos3x.iworx.i386.rpm  
php-odbc-4.3.11-100.cos3x.iworx.i386.rpm  
php-pear-4.3.11-100.cos3x.iworx.i386.rpm  
php-pgsql-4.3.11-100.cos3x.iworx.i386.rpm  
php-snmp-4.3.11-100.cos3x.iworx.i386.rpm  
php-xmlrpc-4.3.11-100.cos3x.iworx.i386.rpm

But I’m not sure what I have to update in the php.spec file

Could you please confirm me this is ok and/or give me a biref howto to perform this chris

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://forums.interworx.com/uploads/default/original/2X/4/40ab17cc34b792a0172b48ad1333b9ba9299a9a1.png) [@system](https://forums.interworx.com/u/system)\
**Post date:** [May 3, 2005, 9:24am UTC](https://forums.interworx.com/t/php-zip-function/9649/7 "2005-05-03T09:24:29Z")

</div>

Ok apparently everything is fine :

Now I have zip support enabled. I just have to test it now 🙂

[http://www.carat-hosting.com/phpinfo2.php](http://www.carat-hosting.com/phpinfo2.php)

Also, I have installed ALL rpm generated

Pascal

---

<div class="post-metadata">

**Author:** ![system](https://forums.interworx.com/uploads/default/original/2X/4/40ab17cc34b792a0172b48ad1333b9ba9299a9a1.png) [@system](https://forums.interworx.com/u/system)\
**Post date:** [May 3, 2005, 9:51am UTC](https://forums.interworx.com/t/php-zip-function/9649/8 "2005-05-03T09:51:58Z")

</div>

I have tested the ZIP finctions and it works great

Thanks Chris to gave me the idea to use the SPEC file 🙂

Pascal

---

<div class="post-metadata">

**Author:** ![Justec](https://forums.interworx.com/letter_avatar_proxy/v4/letter/j/e47774/32.png) [@Justec](https://forums.interworx.com/u/Justec)\
**Post date:** [February 14, 2008, 8:27am UTC](https://forums.interworx.com/t/php-zip-function/9649/9 "2008-02-14T08:27:09Z")

</div>

Google found this thread in the forums graveyard 🙂

Is there a php package that I can install now like I have with other addons?

like yum install php-zip?

---

<div class="post-metadata">

**Author:** ![IWorx-Chris](https://forums.interworx.com/letter_avatar_proxy/v4/letter/i/ba8739/32.png) [@IWorx-Chris](https://forums.interworx.com/u/IWorx-Chris)\
**Post date:** [February 14, 2008, 8:32am UTC](https://forums.interworx.com/t/php-zip-function/9649/10 "2008-02-14T08:32:20Z")

</div>

Unfortunately no Justec :(. You’ll have to recompile as Pascal did to get it working.

Chris

---

<div class="post-metadata">

**Author:** ![Justec](https://forums.interworx.com/letter_avatar_proxy/v4/letter/j/e47774/32.png) [@Justec](https://forums.interworx.com/u/Justec)\
**Post date:** [February 14, 2008, 12:38pm UTC](https://forums.interworx.com/t/php-zip-function/9649/11 "2008-02-14T12:38:46Z")

</div>

Thanks for the quick reply Chris… Decided to just go with system(“unzip file”) since I just needed to unzip a file.
