A Few Questions First
How often do you FTP a new wordpress install to your live server?
Well if you are a freelance web designer or developer then I would say quite often. Every time you put a new site live you have to upload the entire wordpress site which can be 800+ files.
How long does it you take to upload your whole wordpress site?
The last time I timed it (with a fresh install of wordpress 3 beta 1), it took over 10 minutes to upload the 815 files (10.7 MB).
Why does it take so long?
Besides my really slow internet connection, it’s really FTP’s fault. Depending on the software you use (I use FileZilla), you can choose how many concurrent transfers, but when you are uploading 800+ files, being able to transfer 10 files at once still can take a while. Also, the file size is a factor and the fact that most of the files being transferred are php files means that there is major room for improvement from a compression point of view.
The Obvious Next Step - ZIP
Obviously we need to compress the files into a single zip archive. We could then upload the much smaller file to the server. The only problem left is that we need to unzip the file once it has been uploaded onto the server. And one way to do that would be to write some PHP code to do this task for us. But since you are reading this article in order to save time, I am guessing you don’t have time to write this code either.
PHP UnZIP comes to the party and fills this gap. It allows you to FTP your much smaller zip file onto your server and then unzip it in 1 click. All the logic is contained in a single file ‘unzip.php’ which weighs in at 98KB. So all we need to do is FTP our zip archive together with the unzip.php file and we can do exactly what we have set out to.
Step By Step
- Download unzip.zip and extract unzip.php.
- Zip your wordpress install (or whatever else) into a single zip.
- Upload your new zip together with unzip.php to your server via FTP. Make sure the zip file is in the correct directory on your server where you would like it to be extracted.
- CHMOD unzip.php to 777. I do this with my FTP program (FileZilla) by right-clicking on the file and selecting ‘File Permissions’. (for windows you will have to allow full control or modify secutiry permission to the necessary user)
- Open the file unzip.php in your browser.
- Browse your server’s directories and click the zip file to UnZIP it!
- Delete both the zip file and unzip.php.
- Decide what to do with the extra time you now have.
Comparison Of Before And After
|File Size||10.7 MB||3.2 MB|
|Time Taken||14 mins||2 mins|
UnZIP In Action
- The code that handles the zip extraction is the PhpConcept Library - Zip Module 2.8.2 which you can download at http://www.phpconcept.net/pclzip/pclzip-downloads
- I minified the zip library with this cool PHP minifier tool.
- I ‘embedded’ the images used in unzip.php with this cool tool.
You can now upload your entire WordPress website to your server in a quarter of the time or less using UnZIP. I hope you find this useful, and please let us know what you think or if there are ways to improve it.
Download here : unzip.zip