tags:

views:

64

answers:

3

I simple want to rar a folder with the help of php, so there's 2 ways to do this one is via shell_exec or exec, which isnt working for me but shell_exec and exec is enabled on server and working for other commands

other method is via .sh file, but i dont know how to use it properly :(

i need some code which works properly for this

i m trying use this command

rar a -v100m -m0 /home/admin/somefolder.rar somefolder-to-rar

its ubuntu 9.10

A: 

if other shell commands work then rar should.

is rar.exe on the path on the machine? or are you specifying the full path to rar.exe in your command?

Sam Holder
nope i m not specifying the full path of rar
Sjne
A: 

With php you can use backticks (``) to execute a command (from php.net)

I'm not sure what it would be to rar, but zip would be:

<?php
  `cd $dirToZip; zip -pr $nameOfZipFile *`
?>

Assuming your command is correct and rar is accessible from cli the backticks should work.

RDL
A: 

Check the working directory, and try using passthru to display any error from the output

Javier Parra