How to Unzip WordPress Package Files on Server

How to Unzip WordPress Package Files on Server

Often we want to install WordPress manually on our own instead of going through the cPanel administration interface. WordPress is an incredibly easy application to set up. All you require is FTP access and the appropriate versions of PHP and MySQL. Unfortunately, the WordPress download file is a “zip” archive and we need the extracted files in our directory or subdirectory in order to work with them. The FTP protocol doesn’t allow the zip file extraction so we need to do it ourselves. One way of course is to manually unzip the archive on our local computer and upload the extracted folder via FTP. But this can be a long and laborious process. A typical fresh WordPress installation has lots of files and folders and since FTP transfers one file at a time, it can get pretty tiresome especially if you have several installations to take care of. To unzip WordPress package files on the server efficiently, we need to use another technique.

One way is to get shell access and extract the files directly on the server itself. But that’s a different ballgame altogether. Many people are familiar with FTP but don’t want to bother with shell access. Fortunately, the PHP environment itself provides us with an easy way to unzip files. And since PHP is a file-based framework, all we need to do is write a line of code to get the job done. Here’s how we go about it.

Upload the PHP Script

The first step is to download the fresh WordPress installation from the official website. Head to http://wordpress.org/download/ and obtain the zip archive on your desktop. Once the download is complete, make a note of the filename. It’ll typically be “wordpress” followed by the version number. We’re going to use this filename to create a simple PHP file. Open up notepad or a plain text editor and type in the following lines:

<?php
$unzip = shell_exec("unzip wordpress-3.8.1.zip");
echo 'Unzip command executed';
?>

In the second line, replace the file name ending with the “zip” extension with whatever name you obtained in the first step. In this example, I’m simply using the latest WordPress version number. Save this file with a .php extension. I’m calling it “unzip.php”. Using FTP, upload this file onto your Web server.

upload unzip

It’s important to keep in mind that by default, the WordPress archive will extract into a directory – usually called “wordpress”. So if you place unzip.php (and the zip archive) into your root location, the WordPress files will be extracted into root/wordpress. If this is not the behavior you want, you may consider extracting the files onto your desktop and then rezipping them so that they extract into the original location instead of a sub directory.

Uploading WordPress and Extracting

Next, simply upload the WordPress archive file into the same location that you placed unzip.php. Now you just need to visit the PHP file using a web browser by typing in the location you uploaded it to. If all goes well, the extraction should proceed smoothly and you should see a confirmation message as shown below:

unzip over

And here you can see that the extraction has indeed progressed smoothly. The process has created its own directory into which the WordPress files have been extracted.

wordpress unizpped

From here, you can set the blog address either to a renamed sub directory or even the root – but that is a discussion for another day. You can use this technique to unzip any archive of course, not just WordPress. If you find yourself doing this regularly, you save yourself a lot of time and effort!

8 Comments on “How to Unzip WordPress Package Files on Server”!

  1. Avatar

    Hi Bhagwad Park

    Is there any dangerous if we put some code like “rm – rf directori-of-system” ?
    Or php file just can do effect with file/directori in same location?

    Also thank your post!

  2. Hi – I got the message to appear that the job had been done, but the job did not get done. I put a zipped file of 4 folders into my uploads folder and adjusted the name according to your instructions for the unzip.php file. Nothing unzipped. I even changed the text to read something a bit bawdier, which worked. I then zipped just one folder to the uploads folder, changed the title in the unzip.php just for kicks, and couldn’t even get that to unzip. The name was simply “2012.zip” and I got the php file should to have this:

    I’d love for this to work since I’m always killing time waiting for files to upload.

    Any clues?

  3. You have GOT to be kidding! You call this “incredibly easy”??? How is it easy, when we don’t even know what a PHP is? I have downloaded the zipped file three times; have unzipped it three times; have changed the name of the folder – NOW WHAT??? How do I USE it? How do I begin to use WordPress as my platform?

    Just having to ask these questions makes it NOT incredibly easy.

    • Well it is quite easy compared to many other Content Management Systems. Let me help you out.

      First, who’s your web hosting provider?

  4. Hi,

    I have downloaded wordpress. I have Godaddy webhosting. But I cannot find a way to succesfully unzip this. It seems as if I need to purchase MySQL. Its expensive as well. I thought this was going to be an easy project for me to learn to make my own wordpress blog site. Any help is appreciated. Just need to unzip WP on my PC, and then get it up on my Godaddy hosting.

    Thanks

Leave a Reply

This Website is Hosted by

Powered by RamNode

Disclosure: We receive a compensation from some of the companies whose products or services are presented on our website.