Get Error 403 for some fotos that are there!


I am working on a new Web site. Pages of this Web site are generated by Php with the text content pulled out of a MySQL DB and the images pulled from flat files of a directory.

However strangely some of the fotos are not displaying. These fotos are there. I confirmed this by downloading them to my PC and opening them up. But strangely when I am trying to access them via the Web, I get:
Access forbidden!
Error 403

For example this foto on the new Web site is not showing:

But the same foto on the old Web site is showing:

And this foto on new Web site is showing:


BTW, all the fotos on the new site were copied via Linux CP command from the old site.

So What do I need to do fix this Apache foto loading Error?



Just wanted to let you know that I found a pattern between fotos that load and those that do not. Those that do not are like this:

-rw------- 1 root root 198973 Feb 24 17:09 18_34356_foto2.jpg

and those that load are like this:
-rw-r–r-- 1 root root 168924 Feb 24 17:09 18_34356_foto1.jpg

So those that do not load have their permissions set like this:


rather than like this:


But the amazing things is that these same files which were copied from another locations, with same permissions load from the original dir but not the new dir!

SO with the above observation if you have any suggestions now to solve the problem that would be appreciated.

and those that load are like

Sounds like Apache on the new location doesn’t have access to open the images.
Do an ls -al in the directory where the images are and make sure the permissions and owner are set correctly.


1st allow me to bring to your attention that some images from that dir load Ok, and some dont!!! For example:

this foto on the new Web site is not showing:

but this foto is showing:

With that said:

1- I have set the permission for this new dir: news_images to be 0777
which would mean anyone can read or write to this dir.

2- I am logged into this dir news_images, how do I make sure beyond the above setting that anyone can read or write from this dir?


But the same foto on the old Web site is showing:

Do all images belong to the same owner?

The images are uploaded by the users of our Social Networking service. They do it via their Web pages. And FYI:
1- These Web pages are Php generated
2- The images are saved not in a MySQL but as files in dir
3- I just copied the image dir from where it was before to the new location. Of course all the images load Ok in the old location, but again SOME of them do not load Ok in the new location!!!


I’d still like you to answer my question: are all files owned by the same *nix user? i.e. when you ls -la, does it say the same username and group on all images?


Yes, all the files are owned by same user. I think root.
Here is a copy & paste of some of the files:

-rw-r–r-- 1 root root 18440 Feb 24 17:09 982_36750_foto1.gif
-rw-r–r-- 1 root root 9688 Feb 24 17:09 982_43088_foto1.jpg
-rw------- 1 root root 19136 Feb 24 17:09 993_34821_foto1.jpg
-rw-r–r-- 1 root root 31093 Feb 24 17:09 99_32940_foto1.jpg

I’m curious to learn the resolution of this. Sounds like an interesting mystery and I thought it’d be solved by now. Since it’s quiet, let me throw in my 2 cents; however I must warn you that it’s not worth that much.

Obviously, something must be different about the two group of files. Would seem to be a permissions issue. The permissions list you pasted doesn’t appear to show the one file you say you are having issues with. How about a list of the permissions of several files you are having issues with and a list of several files that are working inside the same directory and each file marked to indicate which are and aren’t displaying.

Next, I’d be curious what the file sizes are for several of the images that aren’t loading, and several that are. Just out of curiosity.

Yes, it is a real mystery and I must say I am disappointed that no one here has been able to provide a suggestion to solve this problem.

As far as other stuff I wrote, I looked to them to find any difference between images that load from that dir and those that do not load. And cannot find any pattern. That is both large and small images load and do not load. And again reminder that all these images load Ok in their original dir, but again SOME of them do not load in the new dir!!! WHAT THE HEK :frowning:

Enter these commands while in that directory:

chmod o=r *
chmod g=r *

And all should be well with the world again :slight_smile:

Files are now uploading OK from that dir.

But still the strange thing is WHY these files with the same permissions load Ok from the original dir but NOT from the new dir into which they were copied into!