Answer Already posted in the respective links of stackoverflowhow-to-compress-or-convert-to-low-quality-mp3-file-from-php
While using zip command line with PHP to add a folder into an archive file:
General command:
zip archive.zip file.mp3
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';}?>