ZIP one or more mp3 files using PHP

Hi!,

I need to zip one or more mp3 files using PHP. Can anybody help me to do this?

Thanks in advance,
S:
LVL 5
prsupriyaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

snoyes_jwCommented:
You'll need to get a third-party class or addon.  The PECL zip functions are read-only.

Try these:
http://www.phpclasses.org/browse/package/945.html
http://sourceforge.net/projects/phpziplib
http://www.phpconcept.net/pclzip/index.en.php 

or use one of the system functions (system, exec, etc.) to run a zip utility from the command line.
jasco4617Commented:
you can probably use the exec() function to do this.

<?
 
     $zipPath = "/usr/bin/zip";        //dependant on your system, set accordingly

     exec('$zipPath -b outoutFile zipFile1 zipFile2 zipFile3');

?>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jasco4617Commented:
I am sorry, i have the syntax for the zip program wrong....use the following instead:

    exec('$zipPath outoutFile zipFile1 zipFile2 zipFile3');


I put a "-b " in there when i shouldn't have.



I hope this helps
nicholassolutionsCommented:
Just to expand on what's been said, the PHP docs have info on this: http://us2.php.net/zip
And I believe I used this in the past with some success: http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=957&lngWId=8
prsupriyaAuthor Commented:
Hi!  jasco4617,

Thanks for you response.

I used option as -j inorder not to create any subfolders if the zipfile location is given as relative path

 exec('$zipPath -j outoutFile zipFile1 zipFile2 zipFile3');

Thanks,
S:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.