Protected Links
ExpressionEngine 2, ExpressionEngine 3, ExpressionEngine 4, ExpressionEngine 5, ExpressionEngine 6
Back to this add-on's main page
View Other Add-ons From Yuri Salimovskiy
memory size error
Support Request
yann
|
Posted: 19 April 2012 08:54 PM |
|
|
|
I tested this add-on on my dev version of the site and it worked beautifully… Only problem is… I tested with small files locally… Not that I just put the site live and that the protected links link to music files for sales, I get this error:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 126291048 bytes) in /.../system/expressionengine/third_party/protected_links/mod.protected_links.php on line 214
I tried to add up to 128MB of memory via php.ini but it doesn’t fix the issue. The downloadable file is 515MB. Nowhere did I read that this add-on worked only on small files nor did I imagine that it mattered… Does it? The site went live and is completely broken… Any help MOST appreciated… Thanks!
|
|
|
Yuri Salimovskiy
|
Posted: 20 April 2012 01:13 AM |
# 1
|
|
Developer
|
If you’re serving large files, it is highly recommended to use “local” mode and not URL. Are you able to convert URLs to local path? That should solve the problem.
|
|
|
yann
|
Posted: 20 April 2012 12:55 PM |
# 2
|
|
|
Just in case someone runs into same problem:
storage="local"
does the trick indeed.
Thanks!
|
|
|
Seb
|
Posted: 21 May 2012 03:24 PM |
# 3
|
|
|
Thanks Yann. We’ve just run into this problem. On a 300MB file to download, Protected_links was demanding another 300!
|
|
|
Seb
|
Posted: 21 May 2012 03:55 PM |
# 4
|
|
|
Spoke too soon. We can’t use local files because we’re storing them, through Channel Files, on an Amazon S3 Bucket. Our Protected_Links tag looks lie:
{exp:channel_files:files entry_id="{entry_id}"} <a href="{exp:protected_links:generate url="link="yes"hotlink="yes"lock="yes">Download</a> {/exp:channel_files:files}
I just tried adding storage=“S3” but I get a blank screen if I click on the links.
Any clues?
|
|
|
Yuri Salimovskiy
|
Posted: 22 May 2012 02:11 AM |
# 5
|
|
Developer
|
Hi Seb,
when serving files from S3, you need to provide storage=“s3” parameter (make sure it’s lowecase). Also you’ll need bucket name specified as “container” parameter (ex. container=“mybucket”) and actual file name (only file name, without bucket name) as value of “url” parameter.
If you get blank screen, try setting EE debug preference to show errors to everyone and check whether you see any errors.
|
|
|
Seb
|
Posted: 22 May 2012 06:33 AM |
# 6
|
|
|
Thanks for that Yuri.
I’ve given it a whirl. The links work now but when I click and download the zipped file it’s empty: ie when I unzip it it spits out a zero KB .cpgz file.
I’ve followed the advice on a previous post that had a similar issue. But that hasn’t resolved it. I’ll do some more testing.
|
|
|
Yuri Salimovskiy
|
Posted: 22 May 2012 06:47 AM |
# 7
|
|
Developer
|
Try setting EE debug preference to “show errors to everyone” and then open that .cpgz file with a text editor and see if there’s some message in it
|
|
|
Seb
|
Posted: 22 May 2012 07:01 AM |
# 8
|
|
|
Thanks. I’ll set debugging in a second. In the meantime this is what the .cpgz file contains:
<h4>A PHP Error was encountered</h4>
<p>Severity: User Warning</p> <p>Message: S3::getObject(domainName, filename.zip): [PermanentRedirect] The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</p> <p>Filename: amazon/S3.php</p> <p>Line Number: 222</p>
</div><div >
<h4>A PHP Error was encountered</h4>
<p>Severity: Warning</p> <p>Message: fclose(): 40 is not a valid stream resource</p> <p>Filename: protected_links/mod.protected_links.php</p> <p>Line Number: 267</p>
Hmm. Endpoints. I’ve seen this issue before. Our bucket is in Europe and something about Protected_Links and Amazon buckets in Europe don’t work.
|
|
|
Yuri Salimovskiy
|
Posted: 22 May 2012 08:29 AM |
# 9
|
|
Developer
|
I’m not sure what it “endpoint” it S3 terms, but my guess is that you need to use some sort of “alternative” name for this bucket. Do you have any idea what that would be?
|
|
|
Seb
|
Posted: 22 May 2012 09:19 AM |
# 10
|
|
|
Something similar happend as described here. And doing some research I concluded that ‘something’ (either Channel Files, Protected Links, the server environment) preferred using US Buckets and not Europe based ones. Unfortunately I think we’re obliged to use European buckets. Hmm
|
|
|
Yuri Salimovskiy
|
Posted: 25 May 2012 01:21 AM |
# 11
|
|
Developer
|
The S3/endpoint issue has been taken care of in latest release. You are now able to select S3 endpoint when creating link (in other words, you can select “Europe” in CP, or set endpoint=“s3-eu-west-1.amazonaws.com” parameter on frontend)
|
|
|
Seb
|
Posted: 25 May 2012 02:29 AM |
# 12
|
|
|
You’re a hero. I’ll give this a whirl now.
Thanks,
Seb
|
|
|
Seb
|
Posted: 25 May 2012 03:50 AM |
# 13
|
|
|
Dang. I upgraded the addon and added the extra europe endpoint parameter. However, when I click on the link I receive an application_force-download.html with the following error message.
A PHP Error was encountered Severity: User Warning Message: S3::getObject(bucketname, filename.zip): [6] Couldn't resolve host 'filename.zip' Filename: amazon/S3.php Line Number: 222
A PHP Error was encountered Severity: Warning Message: fclose(): 36 is not a valid stream resource Filename: protected_links/mod.protected_links.php Line Number: 272
|
|
|
Yuri Salimovskiy
|
Posted: 25 May 2012 12:05 PM |
# 14
|
|
Developer
|
What exactly is filename.zip? For some reason S3 library is trying to parse it as full URL, which is kinda weird…
The URL parameter of tag should contain only the actual file name
|
|
|
Seb
|
Posted: 25 May 2012 12:22 PM |
# 15
|
|
|
filename.zip is a zip file in the s3 bucket that I renamed in the pasted code above to remain anonymous – my client is sensitive about security. The zip file contains videos and documents. Anything else I can do / try?
Just to double check, the link code looks like this:
{exp:channel_files:files} {exp:protected_links:generate endpoint="s3-eu-west-1.amazonaws.com" storage="s3" container="bucketname" url="{file:filename}" only_link="yes" ip_lock="yes" deny_hotlink="yes"} {/exp:channel_files:files}
I wonder if one of my htacces rules is causing the error.
|
|
|