Timeout while creating zipfile for download


A zip file should be automatically created and streamed out for download.
During the creation of the zipfile (using the code http://www.experts-exchange.com/Web/Web_Languages/PHP/Q_21355306.html)
the browser times out.

using either in the script
set_time_limit (0);
ini_set("max_execution_time", 0);

with 0 or a really large number does not fix the problem.

What's the hint?

Who is Participating?
ljw87505Connect With a Mentor Commented:
If you have control of the server environment, I would change the max_execution_time in the php.ini, restart apache, and see if you still have the problem.  If you don't have the problem anymore, something is going wrong with the set_time_limit call (I don't think you can use ini_set for max_execution_time, can you?).

Most web servers have their own time limit that will override PHP's time limit.  In apache it's called "Timeout" in the httpd.conf.  Do you know what that is set to?

Hope this helps
SWB-ConsultingAuthor Commented:

it's set to 300 (I assume that's in seconds?) on the server. Actually the session timeouts after about 30 seconds.

Apache 1.3 on linux, php 4.3.4 ...

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Zipping with gzip? or zip? I wonder... Does it say max execution time hit as an error, or does the screen go blank?
SWB-ConsultingAuthor Commented:
Hi guys,

a zip file. The php code that generates the zip file is linked within the initial question. it does everything within php, no shell commands are executed.

I have increased max_execution_time to 12hrs and it does not help.

Any other ideas?

If this problem is not solvable on this way, I change the page to create the zip, store it at a certain path and show a download link to the user (actually I preferre to stream it directly to the user). How would I "entertain" the browser while creating the zip?
(If I stream the file to the user directly (without sending a download link) I can't send out anything to the browser, because the header is updated with the filesize, after the zip file is created. )

SWB-ConsultingAuthor Commented:
Finally I figured out, that the mem limitation caused the problem. The zip file was simply to large to be kept in mem....
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.