Results 1 to 6 of 6

Thread: How to use RAR archive in PHP?

  1. #1
    Join Date
    Jul 2006
    Posts
    273

    How to use RAR archive in PHP?

    Hi friends,
    Many times there are situations when we want to use the rar files. These files are compressed so prove very useful. But I don't know how to use that in PHP programming language.!! So I thought that instead of searching on Web, it would be better to take some tips from you guys. Please explain me how to use RAR archive in PHP? The detailed information would be appreciable.!!
    (\__/)
    (='.'=) This is Bunny. Copy and paste bunny into your
    (")_(") signatureto help him gain world domination

  2. #2
    Join Date
    Jul 2006
    Posts
    289

    Re: How to use RAR archive in PHP?

    You can consider Rar as a powerful and reliable archiver. This extension allows you to read Rar archives but does not support writing because it is not supported by the library UnRar and it prohibits directly by the license. WinRAR is a powerful archive manager. It can backup your data and Reduce the size of email attachments, decompress RAR, ZIP and other files downloaded from Internet and create new archives in RAR and ZIP file format. These functions are available in the standard PHP module, which is always available.
    Signatures reduce available bandwidth

  3. #3
    Join Date
    Jul 2006
    Posts
    442

    Re: How to use RAR archive in PHP?

    You can use the PECL installation wizard to install the Rar extension, using the following command: pecl-v install rar. You can also download the tar.gz package and install Rar manually. WinRAR can work with SFX archives as with any other archives, so if you do not want to run a received SFX archive. SFX archives usually have .exe extension just like any other executable file. A SFX (SelF-eXtracting) archive is an archive merged with an executable module, which is used to extract files from the archive when executed.
    "When they give you ruled paper, write the other way..." J.R.J.

  4. #4
    Join Date
    Mar 2008
    Posts
    349

    Re: How to use RAR archive in PHP?

    You can use the following steps for Installation of the Rar :
    Code:
    gunzip rar-xxx.tgz
     tar-xvf rar-xxx.tar
     cd rar-xxx
     phpize
     . / configure & & make & & make install
    Windows users must enable the library php_rar.dll in php.ini to use these functions.

  5. #5
    Join Date
    Mar 2008
    Posts
    672

    Re: How to use RAR archive in PHP?

    I think that you should also know about the Resource Types of the Rar Archive. This extension saves 2 inner classes: The representation of the archive, returned by rar_open () and the representation of entries returned by the functions rar_list () and rar_entry_get (). Also the information about the class RarArchive is necessary. This class represents a RAR archive, which can be formed of several volumes (parts) and can contain multiple entries RAR. The objects of this class can be browsed, allowing access to entries in the respective RAR archives. These entries can also be obtained via methods RarArchive:: GetEntry and RarArchive:: list.

  6. #6
    Join Date
    Nov 2008
    Posts
    1,192

    Re: How to use RAR archive in PHP?

    I have provided you with an example of RAR extension filesystem. So just have a look at the following example :
    PHP Code:
    <?php

    $rar_file 
    rar_open('demo.rar') or die("Unable to 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);

    ?>

Similar Threads

  1. No flashplayer-installer in tar.gz archive
    By Illinois in forum Windows Software
    Replies: 6
    Last Post: 02-07-2010, 10:26 PM
  2. 190.38 Non 7-Zip archive error
    By Flacos in forum Monitor & Video Cards
    Replies: 8
    Last Post: 11-06-2010, 12:21 AM
  3. Verify the integrity of an archive
    By TechGate in forum Software Development
    Replies: 5
    Last Post: 07-02-2010, 02:06 AM
  4. Replies: 4
    Last Post: 23-10-2009, 08:26 AM
  5. ZIP SFX archive
    By sagar2dumbre in forum Windows Software
    Replies: 7
    Last Post: 28-02-2009, 05:41 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,201,117.19542 seconds with 17 queries