[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 234
  • Last Modified:

Timeout while creating zipfile for download

Guys,

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);
or
ini_set("max_execution_time", 0);

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

What's the hint?

Best,
jp
0
SWB-Consulting
Asked:
SWB-Consulting
  • 3
  • 2
1 Solution
 
ljw87505Commented:
jp,

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
0
 
SWB-ConsultingAuthor Commented:
sure,

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 ...

Greets,
jp
0
 
ljw87505Commented:
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?).
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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

@prmethyl:
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.

@ljw87505
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. )

Thanks,
jp
0
 
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....
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now