title: PHP: Zipping files as xlsx causes file to become invalid
body: <p>I have to replace variables inside a user-submitted xlsx file and am doing it this way:</p>
  
  <ol>
  <li>Rename the .xlsx to .zip</li>
  <li>Unzip to a temp-folder</li>
  <li>Make the necessary changes</li>
  <li>Zip the files</li>
  <li>Rename the .zip to .xslx</li>
  </ol>
  
  <p>I am using plain ZipArchive in PHP. When I try to open the generated .xlsx in Excel, it fails with a message <code>format or extension invalid</code>. When I compress the temporary files with WinRAR (as zip), and rename the resulting file to .xlsx, it works. The zip files generated with both methods contain the same data structure and files, but the WinRAR file is slightly bigger (10.2K vs. 10.3K with normal compression).</p>
  
  <p>When viewing the garbled code of the files, I could see that the files appear in a different order, but don't know if that's the cause. Any clue would be greatly appreciated.</p>