ZIP one or more mp3 files using PHP


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

Thanks in advance,
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.

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

Try these: 

or use one of the system functions (system, exec, etc.) to run a zip utility from the command line.
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
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
Just to expand on what's been said, the PHP docs have info on this:
And I believe I used this in the past with some success:
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');

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

From novice to tech pro — start learning today.