Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have added

Order Deny,Allow
Deny from all
allow from *my ip*

to my htaccess file but now when I use a function like getimagesize, I get an error while trying to retrieve the data from a local file on the server.

Error: [function.getimagesize]: failed to open stream: Redirection limit reached

When I remove the lines in htaccess it works. I also tried adding "allow from localhost" and "allow from 127.0.0.1" but no avail.

share|improve this question

migrated from stackoverflow.com Mar 7 '11 at 0:47

This question came from our site for professional and enthusiast programmers.

2 Answers 2

Since it's local, why are you using an HTTP request to fetch the image details? A local path would bypass the webserver and make this a moot question. It would also be far more efficient, since you're not creating/request/receiving/tearingdown an entire HTTP request sequence.

Instead of

 file_get_contents('http://yourserver.com/url/to/image.jpg');

use

 file_get_contents('/file/system/path/to/image.jpg');
share|improve this answer

Your htaccess seems correct but it doesn't guarantee that Apache is honoring it. Check Apache's error_log for more details on why it's denying access and also if you're allowed to override these settings.

If these files are local, you should probably specify the local path instead of going through HTTP.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.