How to Extract ZIP Files on FTP Server using PHP?

by on January 29, 2009

I was having hard time uploading CMS files to the server to install it, but finally I found this great script that works fine for me, now I can FTP the zip files, and then unzip them easily in no time at all using the unzip script. 

Overview:
This application is useful when there is a need to upload a many files with complicated directory structure to web server, for example, forum systems (like phpBB) or other applications like phpMyAdmin) which consist of many files arranged in complicated directory structure. All you need to do is to upload the archive file and PHP Unzipper will take care of creating the correct directory layout and file extraction. This program is especially helpful when you don’t have FTP access to web server but generally it will be helpful in all cases when there is a need to upload many small files to web server.

Network assessment services help companies run their IT resources smoothly and efficiently.

Installation:

  1. Upload files index.php and pclzip.lib.php to your web server (of course, put both files in the same directory, also you can rename index.php to whatever you wish)
  2. CHMOD index.php to 777
  3. Open index.php in your web browser, it will ask to register first.
  4. Type in the username and the password
  5. Now you can login and start to use the program.

Note: username and password are stored in the pass.php file and they should be absolutely inaccessible to anyone except you. If you ever forget/want to change them, just open this file and they will be there :)

Usage:
Everything is as simple as possible here:

  • Browse through directories and look for zip files.
  • Once you find a zip file you can either view its contents or unzip it. If you choose to view it, file listing will be displayed. If you choose to unzip it, the archive will be extracted in the same directory.

You can download it here, I am sharing it with everybody as it’s licensed under GNU Lesser General Public License.

Most Commented Posts

{ 46 comments }

Saif Al-Kalbani April 11, 2009 at 5:52 PM

Dear Friend,

I face the same problem and you help me at the end.

Thanks friend

Bilal Ahmed Bajwa April 11, 2009 at 7:49 PM

Perfect Solution.
Thanks

Hesham April 12, 2009 at 12:39 AM

@Bilal Ahmed Bajwa, You are welcome, glad that you like it!

Nina April 22, 2009 at 4:51 AM

This is really great

Hesham April 23, 2009 at 2:31 AM

Thanks @Nina, Glad you like it and I hope it will be useful for you!

fatmaggie May 31, 2009 at 2:45 PM

didn’t work for me, size error

fatmaggie May 31, 2009 at 2:51 PM

this is what i get

Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 543 bytes) in /**/pclzip.lib.php on line 3387

Hesham May 31, 2009 at 5:14 PM

Hello @fatmaggie, i am not the developer who made this script, I have used it before and it worked for me just fine, maybe you didn’t follow the steps, plz try to follow the steps once again!

thanks for your visit.

sabina June 5, 2009 at 7:16 AM

Thanks it works for me too but i havenot tried for the file having more size…but it works…..

Hesham June 5, 2009 at 10:37 AM

@sabina, That’s good, thanks a lot for your feedback!

Ran June 12, 2009 at 11:14 AM

Just perfect. Thanks!

Hesham June 12, 2009 at 11:41 AM

You are welcome @Ran, I feel great when ever someone find this useful!
.-= Hesham´s last blog ..Features That Didn’t Make it into Wordpress Version 2.8 =-.

IJ Styles June 19, 2009 at 2:32 PM

Very cool post. These are the informations that I was looking for. Stay Awesome!

Hesham July 21, 2009 at 11:49 PM

@IJ Styles, You are welcome.. check my latest post for more scripts!
.-= Hesham´s last blog ..How To Compete Limited Godaddy File Manager Archiving Tool =-.

Anirudh Singh July 1, 2009 at 5:18 PM

You save lot of time.
Thanks a lot.

Hesham July 21, 2009 at 11:48 PM

@Anirudh Singh, Great .. you are welcome!
.-= Hesham´s last blog ..How To Compete Limited Godaddy File Manager Archiving Tool =-.

Guru Amrit Preet Singh August 2, 2009 at 3:24 AM

Its cool. Thank you very much for sharing the unzipper.

Hesham August 2, 2009 at 11:23 AM

@Guru Amrit Preet Singh, thank you for your comment, I am happy that this helped you! Good Luck!
.-= Hesham´s last blog ..How to Generate Content and Ideas for your Blog from your own Tweets by Twitter Tools? =-.

Salmon August 19, 2009 at 12:19 PM

Uhmmm im having a problem, once i finished registering and click on the “you can login now” link i just get sent back to the register page …

Hesham August 22, 2009 at 1:37 AM

@Salmon, I am so sorry Salmon, I am not into code that much, I am just using this script and it’s working for me just fine! I am not sure why you are getting this error!
.-= Hesham´s last blog ..Nothing can stop Famous Bloggers Club FBC from Getting Famous =-.

Kiuncobra August 21, 2009 at 1:16 PM

how to turn CHMOD to 7777 ..
what is it ?
and how is it ?

please help me brother
.-= Kiuncobra´s last blog ..[Mp3] Aadhavan[LAME | VBR | Crystal|Clear|Quality+ With Cover] =-.

Hesham August 22, 2009 at 1:44 AM

@Kiuncobra, This post will help you to understand what is CHMOD
.-= Hesham´s last blog ..Nothing can stop Famous Bloggers Club FBC from Getting Famous =-.

reckjavik September 12, 2009 at 12:23 PM

OMG IT WORKS great I am really appreciate for your work ,you saved my time
thanks friend.!!!!!

Hesham September 12, 2009 at 5:01 PM

@reckjavik, Yeah it’s working and this is why I share it with all of you! you are welcome!
.-= Hesham´s last blog ..36 Links at Spicy Week on Twitter =-.

reckjavik September 12, 2009 at 12:28 PM

can u tell how I extract other formats using this .? or do I need another codes or an extension?

Hesham September 12, 2009 at 5:02 PM

@reckjavik, I am sorry but this is the only format this code can handle, I am not the developer of this script! but I will be so happy if I got an email or a comment from you one day telling me that you have found something interesting!

rckapildev October 29, 2009 at 1:25 AM

awesome tool, its working fine for me

Hesham October 29, 2009 at 1:26 AM

@rckapildev, I am glad that you find it helpful for your work!
.-= Hesham´s last blog ..Famous Bloggers are Driving Me Crazy! =-.

saidbakr November 10, 2009 at 6:42 PM

Thank you very much. It seems like a magic for my problem!
.-= saidbakr´s last blog ..نوع وضيع من البريد التطفلي =-.

Mushtaque Asghar November 14, 2009 at 1:30 PM

Please help me, I am getting following error:

Warning: chdir() [function.chdir]: open_basedir restriction in effect. File() is not within the allowed path(s): (/home/:/usr/lib/php:/tmp) in /home/a9030732/public_html/upload/index.php on line 249

Faulkner November 14, 2009 at 3:55 PM

no it works well It works well with me well
set the CMD to 777 and dont put the .php files into the root directory it may cause the trouble.

and make sure your host supported with latest php version.

it doesn’t need a SQL database. :)

Tim April 14, 2010 at 6:53 PM

Worked great!! Thanks so much!

Mideen Arif April 20, 2010 at 5:07 PM

Thank You. Works great.

Adil May 24, 2010 at 11:23 AM

hi br0 ! when i open unzip.php the file,it gives the following error

“Warning: is_dir(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (/www/zzl.org/t/e/s/testsite123/htdocs) in /www/zzl.org/t/e/s/testsite123/htdocs/unzip.php on line 218 Warning: is_file(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (/www/zzl.org/t/e/s/testsite123/htdocs) in /www/zzl.org/t/e/s/testsite123/htdocs/unzip.php on line 226 Warning: is_file(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (/www/zzl.org/t/e/s/testsite123/htdocs) in /www/zzl.org/t/e/s/testsite123/htdocs/unzip.php on line 228 .ftpquota
pclzip.lib.php
unzip.php
wordpress.zip”

and when i try to unzip the file it gives the following error

“Browse your server directories to find the zip file you want to unzip. Click the file to unzip it. Please make sure you have given appropriate permissions! Abort unzip.php : Missing zlib extensions”

Please help out

Hesham August 20, 2010 at 10:42 PM

@Adil, I am not sure! I am sharing what works for me! sorry for that!
.-= Hesham´s last blog ..Thesis Themes Tutorials for WordPress Blogs that you are Looking For =-.

Eric Gillis July 22, 2010 at 4:16 PM

Excellent tool. Thanks for posting.

Jasa Pembuatan Web August 26, 2010 at 3:51 AM

Thanks for share. I’m try :)
.-= Jasa Pembuatan Web´s last blog ..BGU ikut donasi untuk Joomlaorg =-.

popo coco August 31, 2010 at 8:26 PM

Perfect !!!

Thank you for this one!

mobsguy September 3, 2010 at 3:26 PM

Thank you for sharing! great post!
.-= mobsguy´s last blog ..My Online Business Strategy System =-.

Claud October 2, 2010 at 10:16 PM

This is just beautiful… thanks Hesham!

study skills for highschool December 16, 2010 at 7:10 PM

Thanks for the info though a lot has already a knowledge on this still it is a great reference

Yusif February 6, 2011 at 11:28 PM

Hi i have error :(
Abort pclzip.lib.php : Missing zlib extensions

Alan Vasconcelos May 12, 2011 at 3:53 AM

You’re the Man!!
Awesome!!

Do you know a similar solution to compact files on server?

Again,
Thank you!!!

urkur July 31, 2011 at 8:57 PM

Excellent program. Thank you very much for sharing !

confused !!! August 18, 2011 at 10:07 PM

hmm i dint get the pass.php file in the donload u provided.

Jayy August 22, 2011 at 11:33 AM

This is AWESOME :D ,
thanks buddy!

Previous post:

Next post: