Skip to main content

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:
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';
}

?>
output:

code:
updating: ../downloads/medias/mp3/001.mp3 (deflated 6%)
i cannot find file, , don't know whether created or not.

in command line:

code:
$ zip archive.zip 001.mp3    adding: 001.mp3 (deflated 6%) $ ls archive.zip
thanks in advance

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

Popular posts from this blog

Could not place because the source rectangle is empty

Thread: Using smartcard reader with vpnc

Adobe Font Folio 7.0 or just 7?