We are controlling access to file downloads through a script. To access
your file you need via a 40 byte key (passed on URL) and a verification
code that are both checked by PHP. If everything checks out, PHP retrieves
the file from an IFS directory that is not available via Apache itself. We
use the fread function to read chucks of the file at a time and send it to
the browser. Once the download is complete, it is disabled so a second
download isn't possible without our consent. Of course, all the activity
is logged so we know who is accessing the file.
Since PHP is reading and sending the file a byte at a time (essentially),
the max execution time limits of PHP and the Apache apply because the
script is running until the entire file is sent. Our tests show this all
works great except for the timeout issue. If the file is over 1GB, it can
take a while for the download to complete. I am trying to avoid
configuring PHP and Apache to allow scripts to run for hours before a
timeout occurs, but I would like to allow this one script to (basically)
run indefinitely. While not ideal, it is certainly better than making it
possible for any PHP script on the server to run indefinitely.
Hope that explains it.
|------------>
| From: |
|------------>
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|Scott Klement <web400@xxxxxxxxxxxxxxxx> |
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To: |
|------------>
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|Web Enabling the AS400 / iSeries <web400@xxxxxxxxxxxx> |
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date: |
|------------>
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|12/30/2009 12:09 PM |
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject: |
|------------>
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|Re: [WEB400] PHP Apache Functions |
>--------------------------------------------------------------------------------------------------------------------------------------------------|
I don't understand your scenario. Why would the size of a file relate
to whether it times out?
MattLavinder@xxxxxxxxxxxxxxxxxxx wrote:
We are trying to write a PHP Script to control a file download. Files
can
get pretty large, so in the script we are trying to add code to ignore
any
timeout settings. The way to do this is by calling set_time_limit(0) and
apache_reset_timeout() every so often while PHP reads the file. This
allows the one script to run for a long period of time, but we can still
enforce a timeout for our other scripts. When I try to call
apache_reset_timeout(), I get an error saying it is undefined. Haven't
found anything to indicate that these functions requires any special
extensions. Are the Apache functions missing from the IBM i version of
PHP?
Matt
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
______________________________________________________________________
--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/web400..
As an Amazon Associate we earn from qualifying purchases.