Question

(Using XAMPP 1.7.7 with PHP 5.3.8)

I know how to extract *.7z files with PHP/p7zip, but I need to test locally using xampp (I'm using Windows 7 64 bits) and I'm stuck. I tried using exec():

<?php exec('7z e test.7z'); ?>

but it didn't work!

I also tried this:

<?php exec('"C:\Program Files\7-Zip\7z.exe" e test.7z'); ?>

Which naturally doesn't work either.

Out of frustration, I even copied 7z.exe to the PHP script directory but I'm still can't get it to work (in this case 7z.exe complain that it "cannot find archive", even though everything is located under the same folder and the archive does actually exist!)

So, how can can I extract 7z archives using PHP & XAMPP?

Thanks in advance!

Was it helpful?

Solution

did you try to provide full path to test.7z while executing the above command

OTHER TIPS

just give the full path to the archive

$cCommand =  '"'. '"' . "C:\\Program Files\\7-Zip\\7z.exe" . '"' . " l " .  '"' . "P:\Temp\PAB-SQL Import\Downloads\PAB200_FULL_EXPORT_20130902.zip" . '"' . '"' ;

Exact $cCommand contents:

""C:\Program Files\7-Zip\7z.exe" l "P:\Temp\PAB-SQL Import\Downloads\PAB200_FULL_EXPORT_20130902.zip""

exec($cCommand, $output, $nError_value);

Note the double (double) quotes!!

This worked for me.

Gert

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top