Thursday, 15 March 2012

Create and Download Zip File in PHP -


I migrated a LAMP (Linux Apache MySql PHP) system from a physical server to a virtual machine (clean install, not a physical-to-virtual transfer) On the old machine, the following code will search for all $ jid.csv files in the Order Directory, create a zip file, and then prompt the user to download the zip file. On the new machine, the zip file is not created, instead the user is asked to download a zip file of 0 bytes. Apache can write in this folder, because the same PHP script also contains the previously mentioned CSV files.

The script that is failing:

  else if ($ loops & gt; 1) {header ("content-type: app / zip"); Header ("content-dispute: attachment; file name = $ jid.zip"); System ("CD Order; Zip $ Zed Zip Zide - *. CSV> / dev / null"); $ MyFile = "order / $ jid.zip"; Readfile ("command / $ jid.zip"); }  

Thanks in advance.


No comments:

Post a Comment