0
votes

I have on a hosting site with Linux, Apache and php 5.2.17 with allow_url_fopen=true, a php page checking the existence of an image with fopen (fopen($_SESSION['IMG_DIR_REL']."/img/img5.jpg", "rb")); I don't use file_exists because it returns "nothing" :-( . The page is on the subdir ./test/ and images on the subdir ./img/ If I access the page with http (http://www.example.com/test/control.php) the fopen works perfectly giving the right presence of images. But if I access the same page with https (https://www.example.com/test/control.php) I got the fopen(https://www.example.com/img/img5.jpg) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden. If I change to fopen (fopen("../img/img5.jpg", "rb")); it works on https. I googled a bit, testing some examples for similar cases but nothing works. Do you have some suggestions? Thanks in advance.

1

1 Answers

0
votes

That most likely means that Apache doesn't have access to "/img/img5.jpg".

You need to change either permissions or ownership for the file if that is the case.

Make sure the owner of the file is part of the group running the server.

Apache by default runs on the httpd group.