+ Reply to Thread
Results 1 to 8 of 8

Thread: Unrar on Bluehost

  1. #1
    Join Date
    Jul 2008
    Posts
    6

    Default Unrar on Bluehost

    Hi
    is there any way to unrar/rar files on bluehost?

  2. #2
    Join Date
    Apr 2008
    Posts
    407

    Default

    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.

    An example to extract a .tar.gz file:
    Code:
    tar -zxvf file.tar.gz

  3. #3
    Join Date
    Jul 2008
    Posts
    6

    Default

    And any other way? not using the command line, php or something?

    I need rar extraction unfortunatley.

  4. #4
    Join Date
    Apr 2008
    Posts
    407

    Default

    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:

    Code:
    unrar x [filename.rar]
    If that doesn't work, try
    Code:
    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.

    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 Code:
    <?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.
    Last edited by Eriksrocks; 07-12-2008 at 05:41 PM.

  5. #5
    Join Date
    Jul 2008
    Posts
    6

    Default

    Thanks for your nice help Erik, im kind of newbie. where is the "command line" located?

  6. #6
    Join Date
    Apr 2008
    Posts
    407

    Default

    Quote Originally Posted by ice2thesea View Post
    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 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?

  7. #7
    Join Date
    Jul 2008
    Location
    India
    Posts
    4

    Default

    @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

  8. #8
    Join Date
    Nov 2006
    Location
    Sydney, Australia
    Posts
    4,489

    Default

    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?

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts