I need to extract rar file for my custom import extension.
i have used shell_exec()
and exec("unzip/path/images.rar", $result, $returnval);
but not working.
Any one knows how to extract rar file using SSH+php
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityI need to extract rar file for my custom import extension.
i have used shell_exec()
and exec("unzip/path/images.rar", $result, $returnval);
but not working.
Any one knows how to extract rar file using SSH+php
For Debian or Ubuntu Linux use apt-get
For Fedora Linux / CentOS / RHEL use yum
Install unrar on server
sudo apt-get install unrar
for zip file install unzip
sudo apt-get install unzip
then try
exec("unrar unzip/path/images.rar");
for zip
exec("unzip path/images.zip");
Did you try running the rar x archive.rar command inside shell_exec().
shell_exec('rar x path/to/rar/file/filename.rar');
Make sure that path of the rar file is correct.
If the file is in the same folder where your php file is then you can give the filename without giving any path.
First, check if rar is installed in your Linux system.
if not installed, then you can run the following command -
sudo apt-get install rar