We all know about the irony that Dreamhost file manager lacks zip compress uncompress feature. DreamHost is one of the best reliable web hosting that offers powerful shared hosting. In fact it offers more powerful hosting than HostGator in terms of CPU capacity. Dreamhost offers more system resource per shared hosting account.
Updated – PHP way to extract archive on a web hosting
Effective and easy method to unzip files using a simple php code
- Connect to FTP > go to the directory where you have zip file to extract > Create a new file names unzip.php > add the following code to that file;
<?php
$zip = new ZipArchive;
if ($zip->open("myzipfile.zip")){
$path = getcwd() . "/dirToextract/";
$path = str_replace("\\","/",$path);
echo $path;
echo $zip->extractTo($path);
$zip->close();
echo 'Done.';
} else {
echo "Error";
}
?>
- Replace the blue text with the your zip file name, replace the red text with the child directory where you want to extract the files or leave it blank to extract the files in the same directory
- Now open the exact file path in your browser (http://yourdomain.com/path/unzip.php). Running this PHP file will extract your zip archive.
- Delete the unzip.php after successful extraction.
Method 2 – Using SSH client PuTTY
The only and a big disadvantage using DreamHost is the absence of zip / unzip option in file manager without that you can’t do many things easily like uploading a large website containing thousands of files. If you have a large package to upload that includes thousands of files in that, you need to compress it in zip format and then you can upload it much faster in comparison to uploading files in uncompressed conditions using FTP. Later you can decompress it on server within a few seconds. This method saves a lot of time and effort. Most of the web hosting companies uses cPanel having a blazing fast file manager that can compress decompress files easily and within a while.
First see this video and then read this tutorial
I would not be happy if you leave or skip such a great web hosting just because it doesn’t feature zip unzip feature and I am 100% confident that you will be able to easily compress uncompress files on DreamHost using this tutorial.
- Go to DreamHost hosting panel and give SSH access to your default user.
- Download free SSH software PuTTY.
- PuTTY will be download within a few seconds and it is not an installable package but a standalone executable file that will be opened on double clicking
- Now enter your hostname as shown in figure. This may be the website domain hosted on your DreamHost account. (domain must be set up and functional with your hosting account), or you can use the default hostname (like dori.dreamhost.com) provided by DreamHost that you can find inside the welcome email from Dreamhost. Then click on OK button’’
- You will be then redirected to command prompt and all will be operated there
- Here first enter your SSH username and press ENTER
- Now type your password. Keep in mind that password will not be visible in command prompt in plain text or in dots. So keep typing your password without worry and then press ENTER
- If you provide correct password PuTTY will get you in your Hosting account root and now the real operation is begun.
Unarchiving or unzipping
- To extract a zip file, you need to put your zip file in destination folder ( better to use your DreamHost web based FTP manager to move a file)
- For example if you want to extract your zip file inside a folder name “Test-folder” then create Test-folder and put this zip file in Test-folder (you can create folder using FTP client or DreamHost Web FTP)
- Now in Putty command prompt type the following command unzip filename.zip ( here replace blue text with your zip file name) and then press ENTER (see video)
- Your zip file will get extracted inside Test-folder and you can check extracted package using any FTP software or DreamHost Web FTP
zipping up files
- To zip up multiple files, first create a folder and place all files that need to be compressed in that folder ( do it using Dreamhost web ftp client)
- Now get into that folder using PuTTY with following command cd Test-folder (replace blue text with the name of your folder created) and hit ENTER button
- Now, when you are in the folder where all files exist that are to being compressed, type the following command in Putty zip –r anyname * Here replace blue text with any name you want to give the zip files that will be created. Then hit the ENTER button. All files and folder inside the Test-folder will get compressed into a single zip file
- Thus with the help of DreamHost Web FTP and PuTTY, using the following guide you can copy, move, delete, rename and compress, uncompress files on DreamHost hosting. I am sure if you follow this guide properly, your problem regarding DreamHost zip unzip will be solved
Other Important commands to use Putty
ls (to list all files in a directory)
pwd (to see the current directory path)
mkdir newfolder (creating new folder, here replace blue text with folder name)
rm –rf foldername/ (deleting a folder including all files and folders in that, here replace blue text with the name of the folder that you want to delete)