View Full Version : Unrar on Bluehost
ice2thesea
07-12-2008, 03:36 PM
Hi
is there any way to unrar/rar files on bluehost?
Eriksrocks
07-12-2008, 04:05 PM
Using the command line? No.
If you want to archive/unarchive files using the command line, you probably want to use the tar command which deals with Gzip/TAR archives (.tar.gz or .tgz). More info here (http://linuxbasiccommands.wordpress.com/2008/04/04/linux-tar-command/).
An example to extract a .tar.gz file:
tar -zxvf file.tar.gz
ice2thesea
07-12-2008, 04:18 PM
And any other way? not using the command line, php or something?
I need rar extraction unfortunatley.
Eriksrocks
07-12-2008, 06:24 PM
Well, I doubt Bluehost has any rar or unrar packages installed, but try this with a sample rar file to see if it will extract it:
unrar x [filename.rar] If that doesn't work, try
rar e [filename.rar]
Again, I doubt those will work, but it's worth a try.
Otherwise, a solution for PHP. First you have to install the RAR PHP extension.
From the command line, try running pecl -v install rar. If that doesn't work, you'll have to install it manually (http://www.php.net/manual/en/rar.installation.php).
I believe that using the Rar package is the only way to get Rar support for PHP. Anyway, if you get it installed, here is a sample script that extracts a RAR archive:
<?php
$rar_file = rar_open('example.rar') or die("Can't open Rar archive");
$entries = rar_list($rar_file);
foreach ($entries as $entry) {
echo 'Filename: ' . $entry->getName() . "\n";
echo 'Packed size: ' . $entry->getPackedSize() . "\n";
echo 'Unpacked size: ' . $entry->getUnpackedSize() . "\n";
$entry->extract('/dir/extract/to/');
}
rar_close($rar_file);
?>
Besides using PHP or the command line, I don't know of any other way to extract RAR files on Bluehost. I suppose there is some other way to do it in Ruby or Perl, but I don't have any familiarity with other programming languages than PHP. :)
ice2thesea
07-13-2008, 06:08 PM
Thanks for your nice help Erik, im kind of newbie. where is the "command line" located?
Eriksrocks
07-13-2008, 06:14 PM
Thanks for your nice help Erik, im kind of newbie. where is the "command line" located?
You need to request SSH access from the SSH section of cPanel by uploading or sending in a valid Photo ID (Security > Shell Access). Once you have it enabled on your account, you can use a free SSH client like PuTTY (http://www.chiark.greenend.org.uk/~sgtatham/putty/) to connect to your server. From there, you can login and execute commands. :)
EDIT: Just a question: Why do you need RAR support on the webserver? Can you just extract files manually on your PC and then upload them? :)
kmJeetu
07-17-2008, 11:10 AM
@ice2thesea
Did You Managed To rar/Unrar Files
I Used Php Script, But Did Not Worked For Me
I Get Error with raropen()
I had RAR Installed And php.ini Configured
felgall
07-17-2008, 01:19 PM
Is there some particular reason that you need to use just about the only compression format that the server doesn't natively support instead of one of the more standard ones such as zip or gzip?
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.