Creating a Zip file on server with PHP

Status
Not open for further replies.

LazyD

$monies = false;
Dec 7, 2006
655
12
0
Wine Cuntry
wildfoxmedia.com
Before anyone starts up there smartass shit, ive tried multiple PHP classes, scripts and even the PEAR package to create one. They all end up creating zip files that are under 1mb and often have errors in winrar about being corrupt.

The file should be around 150mb since it includes a large mysql dump. The problem im having is that there is no indication of how the progress is going and the browser loads the script and completes - it doesnt continue to load or execute so I never know if its really working or not.

Should I assume that it will take a few minutes, just like my computer would? Is there anyone out there that knows of a PHP script that will do this, no bullshit?
 


Are you sure it's only a meg file due to the script timing out? Most hosts have a default timeout of 15 seconds per PHP script execution.

Try adding set_time_limit(120); to the top and see if the file gets any bigger, that'll let it run for 2 minutes.
 
Doesnt seem to be help - Oddly enough, it seems to be the filesize of the entire thing im trying to zip, minus the 150mb mysql dump. I didnt think about the time limit - I then thought about setting it to 0, but im a little leary of giving this script infinite time to run especially if it tries to zip the entire shebang..
 
Script Execution time is prob your culprit

Ya, script execution time is going to be your first issue with files that big. Sounds like your not having problems zipping, it's a problem with not completing.

Quick and dirty something like this will let you know if the script is completing... though you should get a timeout message if it's not.


Code:
<?php
exec ("zip -r test.zip *");
?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
zip Completed

</body>
</html>

Mondi
 
I want to zip it because thats a more...common file extension. I am zipping files that I intend to sell and distribute and I know if I were to only offer it in tar.gz that people would bitch up a storm about the file format...

Bofu2 - Yea, permissions are fine... I think its something with server or PHP limitations because I tried to create a zip with a handful of files that wasnt very big and it went through fine and echoed out the success message. However, once I try the actual files im going to use, including the mysql dump it doesnt create the complete zip, nor does it ever echo out any message, error or success, and it doesnt ever print out an error for Max execution time....
 
why dont just call zip from the script? i have zip on my box...
seems the more easily way
 
Status
Not open for further replies.