Thread: Compress folder using zip command with PHP
hello everybody,
while using zip command line php add folder archive file:
general command:
code:zip archive.zip file.mp3
php code:
output:php code:
<?php
$path2mp3 = '../downloads/medias/mp3/001.mp3';
$site = 'site.com';
$compressfolder = $site.'.zip';
$cmd = "zip -r $compressfolder $path2mp3";
$compressmp3 = exec($cmd ." 2>&1" );
echo $compressmp3;
if($compressmp3)
{
echo 'done';
}
else
{
echo 'not done';
}
?>
i cannot find file, , don't know whether created or not.code:updating: ../downloads/medias/mp3/001.mp3 (deflated 6%)
in command line:
thanks in advancecode:$ zip archive.zip 001.mp3 adding: 001.mp3 (deflated 6%) $ ls archive.zip
are running script via apache or @ command-line?
if former, may have file permission issues since files created owned user www-data , must placed in directory www-data has write permissions.
if running @ command line, why using php? write shell script.
Forum The Ubuntu Forum Community Ubuntu Specialised Support Ubuntu Servers, Cloud and Juju Server Platforms [SOLVED] Compress folder using zip command with PHP
Ubuntu
Comments
Post a Comment