How to extract .rar file on cpanel

Started on the old forum in September 2010 · view the original in the archive · old links redirect here

8 replies · 5,655 views · started 16 years ago · 1 min read

5 participants
djmasti Newbie · 4 posts #1

How to Extract .rar File on Cpanel Please Help

GiLL Senior · 356 posts #2

By default its not possible if unrar is installed on the server i think u can do it through php or ssh commands

Example #1 Rar::extract() example

<?php

$rar_file = rar_open('example.rar') or die("Failed to open Rar archive");

$entry = rar_entry_get($rar_file, 'Dir/file.txt') or die("Failed to find such entry");

$entry->extract('/dir/to'); // create /dir/to/Dir/file.txt
$entry->extract(false, '/dir/to/new_name.txt'); // create /dir/to/new_name.txt

?>

Example #2 How to extract all files in archive:

<?php

$filename = "foobar.rar";
$filepath = "/home/foo/bar/";

$rar_file = rar_open($filepath.$filename);
$list = rar_list($rar_file);
foreach($list as $file) {
   $entry = rar_entry_get($rar_file, $file);
   $entry->extract("."); // extract to the current dir
}
rar_close($rar_file);

?>
Task: To open rar (unpack) file in current directory type command:

$ unrar e file.rar
Task: List (l) file inside rar archive:

$ unrar l file.rar
Task: To extract (x) files with full path type command:

$ unrar x file.rar

(D) To test (t) integrity of archive, file type command:
$ unrar t file.rar

left wap stuff

morency Senior · 488 posts #3

or you can use a ftp client what can extract .rar files. 🙂

Unamos los corazones,hoy todos somos multicolores!

krazyguy Junior · 17 posts #4

morency wrote: or you can use a ftp client what can extract .rar files. :)

which ftp software support rar extract?

morency Senior · 488 posts #5

I dont know... but our wap ftp client can do this 🙂 I will not spam HERE:D

Unamos los corazones,hoy todos somos multicolores!

djmasti Newbie · 4 posts #6

morency wrote: I dont know... but our wap ftp client can do this 🙂 I will not spam HERE:D

I tried your wap ftp client nice but it extracted only one .rar file and now doesn't extract more why?

GiLL Senior · 356 posts #7

morency wrote: or you can use a ftp client what can extract .rar files. :)

if am not mistaken you should use privacy policy,Terms of use, do you save user login details etc

left wap stuff

djmasti Newbie · 4 posts #8

@ Gill Thanks For Codes Bro, But when i try to use those first 2 Codes they shows error: Fatal error: Call to undefined function rar_open() in /path/ on line 7

modoran Junior · 11 posts #9

You need to have php compiled with rar extension to use that script. No webhost has it installed by default due to licensing issues.

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close