1

I'm trying to create odt file of the files:

enter image description here

using ZipArchive. How I will be able to reproduce this linux command

 zip -r ../zip.odt mimetype *

using ZipArchive in php in Windows?

Community
  • 1
  • 1
Juan
  • 2,073
  • 3
  • 22
  • 37

1 Answers1

2

Use the PHP exec command to run arbitrary code.

exec("zip -r ../zip.odt mimetype *");
dotancohen
  • 30,064
  • 36
  • 138
  • 197
  • OP (yes, I see that is you) specifically asked for "Linux command". If you are on Windows and have the ZipArchive extension installed, then try some of the [ZipArchive examples](http://php.net/manual/en/zip.examples.php). I think that the first example is relevant for your case. Let use know how it went. – dotancohen Oct 19 '14 at 13:57
  • @dotancochen yes I'm using this code http://stackoverflow.com/questions/1334613/how-to-recursively-zip-a-directory-in-php but I get a error input/general error. Then, I want zip directly using zip in line command. – Juan Oct 19 '14 at 14:21
  • Then I recommend either one of two things: addressing the error that you are receiving or using a server OS for your webserver. I know that Windows is a popular desktop OS, but as a professional I cringed when you added "on Windows" to the question. You really don't want to do that :) Post a new question with the error that you are receiving and let's address that. – dotancohen Oct 19 '14 at 14:29
  • I had write a that question but I don't get replies. Here a link http://stackoverflow.com/questions/26444303/create-odt-file-using-zip-php-general-input-output-error – Juan Oct 19 '14 at 14:34
  • I've commented over there. That question is only 18 hours old, you will find that sometimes questions take days or weeks before somebody knowledgeable comes along. – dotancohen Oct 19 '14 at 14:39