views:

287

answers:

2

hey guyz i want rar (not tar) my folder on my server by using php

RAR

RAR 3.93 Copyright (c) 1993-2010 Alexander Roshal 15 Mar 2010 Registered to my real name

OS

Ubuntu Release (Karmic) kernel linux 2.6.32.2-xxxx-grs-ipv4-32 Gnome 2.28.1

latest php an lighthttpd

i have tried these things

http://php.net/manual/en/function.escapeshellarg.php   // may be wrong code 
http://php.net/manual/en/function.exec.php
http://php.net/manual/en/function.shell-exec.php

my command (working in ssh and nautilus script)

rar a -m0 /where/file/will/saved/file_name.rar /location/ti/data/dir/datafolder

php code

$log=Shell_exec("rar a -m0 /where/file/will/saved/file_name.rar /location/ti/data/dir/datafolder");
echo $log;

one method is left which i don't know how to use and its working on server that is by somefile_to_execute_command.sh i have to execute .sh file from php need to send some variables (command) and

i tried this method can rar file with a script named RapidLeech but its rar from only its own files dir only :( but i want to do in different directories.

Rapid Leech rar class

http://paste2.org/p/791668

i m able run shell command with php (cp(copy),mv(move),ls(directory list),rm(remove aka delete)) but got failed to run rar i gives no output i also tried to given path rar and i used alot commands with php Shell_exec function and working like they work with ssh and i have tried almost 80 % method given on net and failed from last 3days i m over now plz help me i need php script file working plz reply if u have any info n code and experience about rar and this kinda :( problem

i m 99% noob just used code mean search Google collect script make my own working thing (for personal use only) n now i m failed to rar folder and file :((

now plz provide me code plz don't talk in technical language because i m just reading my first php book (for dummies :D) mean noob and 0.1

plz help me as much as u can

thankx

A: 

You can use the rar package which comes with ubuntu. Just see rar --help for rar package help. Then, just call it inside the php itself using the system function or the shell_exec.

Mikulas Dite
i tried it but not working n using paid licensed rar ( winrar Downloaded from rarlab and compile it ((also downloaded working executable file) working with normal ssh connection ) rar is working normal with ssh but not working php
Steve
A: 

its working problem of rar file rights and rar dir

Steve