Reputation: 1104
I am experimenting with Google AppEngine and trying to download file from external server to my local machine using simple download script in php hosted at AppEngine.
Sample code snippet is as follows:
header('Content-Type: "' . $mime . '"');
header('Content-Disposition: attachment; filename="' . $name . '"');
header("Content-Transfer-Encoding: binary");
header('Expires: 0');
header('Content-Length: '.$size);
header('Pragma: no-cache');
}
readfile($url);
This is working fine for small size of the file. But it is failing for larger files due to 60 second execution time limitation of GAE. Is there any workaround to accomplish this type of task?
Upvotes: 1
Views: 874
Reputation: 1412
If the file is stored in GCS, you could serve the file directly without the 60s limit. See https://cloud.google.com/appengine/docs/php/googlestorage/public_access#serving_files_directly_from_google_cloud_storage for more details.
Upvotes: 1
Reputation: 120
i can't add comment
from where you are reading file if its from Google Cloud Storage then you can configure your bucket as a static website. read more : https://cloud.google.com/storage/docs/website-configuration
and use Manual Scaling
Requests can run indefinitely. A manually-scaled instance can choose to handle /_ah/start and execute a program or script for many hours without returning an HTTP response code.
read more :: about scaling_types on google
you can save file Google Cloud Storage then access.
if i misunderstand sorry i am also trying to learn Google AppEngine(php) from last month :p another noob
Upvotes: 1