Zipping up a file & adding a password

Hey all!

I’ve been wanting to share this tip for awhile. It’s going to be short though.

Ever wanted to make a file a little more secure by adding a password? It’s easy to do on a LINUX server. All it takes is one line of code:

shell_exec('zip -qjP password '' 'fileYouWantToZip.doc');

Easy cheesy!┬áIf you’re having trouble, both file names may need the directory path as well.

WARNING: This does NOT work on a Windows server. Windows requires you to go use a zip application in order to do this. I learned this the hard way!

That’s it for now! Told you this was going to be short and sweet!


Leave a Reply

Your email address will not be published. Required fields are marked *