How to rar a folder with php?
I just want a "rar" folder using PHP. There are two ways to do this. One is via shell_exec
or exec
, which doesn't work for me, although shell_exec
it is exec
enabled on the server and works for other commands.
Another method is via file .sh
, but I don't know how to use it correctly :(
I need some code that works correctly for this.
I am trying to use this command:
rar a -v100m -m0 /home/admin/somefolder.rar somefolder-to-rar
This is Ubuntu 9.10
source to share
With php you can use backticks ('') to execute command ( from php.net )
I'm not sure if this will be with rar, but the zip will be:
<?php
`cd $dirToZip; zip -pr $nameOfZipFile *`
?>
Assuming your command is correct and the rar is available from the cli, the reverse steps should work.
source to share