You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by ap...@phantomcougar.com on 2002/09/30 08:51:36 UTC

[users@httpd] Error 403 on thumb directory

Hello.

I am getting 403 Errors on thumbnails explicitly stored in a thumbs folder 
on my Apache 1.3.22 server (running under Linux Red Hat 7.1).

I see evidence of the errors in my server logs (for a page of thumbs, my 
users are getting 403 errors at least 75% of the time), however, when I go 
to view the images (from my local network) they show up 95% of the time.  
Only occasionally do I 
have problems, however, I have noticed when i go to a remote computer I 
have problems.

I don't think it is a factor but my thumbnails are generated from a user 
submitted image that is resized using PHP scripts and djpeg and pnmscale.  

My thumbs folder is chmod 775 and chowned by {me}.apache and each thumb is 
chmod 744 and chowned by {me}.apache

I have googled the net for the problem and asked friends but everyone is 
surprised I am having problems based on my permissions.

Is there any way I can find out what is causeing the 403 error or fix 
this? 

Thank you for any help you may be.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Error 403 on thumb directory

Posted by ap...@phantomcougar.com.
On Mon, 30 Sep 2002, Robert Andersson wrote:





> Just a thought, are you sure that the image has been completly written and
> the file closed before sending the redirect or link to it? That might
> explain why it sometimes work, and other times not. How does the PHP
> document work?
> 
> Regards,
> Robert Andersson

I assume it has, and my reason for that is, I can pull up all the images 
in a image viewer (ACDSee, since my server is on my network) and they look 
fine, they are resized as expected (from my PHP script) and they fully 
load.  When using netscape and an image fails to show up, I can right click > 
view image and it will almost always show up the second time.

I shall attach my PHP script for processing/resizing the images here 
(keep in mind I save 2 images to my server, the full size and the thumb, 
and the full size images have always worked and been served without 
error):

======================================================================================

// $iMic is define in a for-do loop, since I can upload 4 imgs at once,
// its value can be 1 thru 4;

// Get XY size of the temp uploaded image;
$img_xy = GetImageSize($HTTP_POST_FILES[$iMic]['tmp_name']);

// create temp file name using tempnam();
$tmpimg = tempnam("/tmp", "TEMP"); // save pnm here;
$picimg = tempnam("/tmp", "IMG"); // save resized img jpg here;
$picthm = tempnam("/tmp", "THM"); // save resized thm jpg here;

// use djpeg to convert image file into pnm file (Raw Image Data);
system("djpeg ".$HTTP_POST_FILES[$iMic]['tmp_name']." > $tmpimg");

// check size -- $img_xy sub 0 is width(X), sub 1 is height(Y);
// if too big, then scale using pnmscale,
// then convert back into jpg using cjpeg, export to temp file $picimg;
if (($img_xy[0]>$MaxPixels)||($img_xy[1]>$MaxPixels)) {
   system("pnmscale -xy $MaxPixels $MaxPixels $tmpimg | cjpeg -smoo 10 -qual 75 > $picimg");
   }
else system("cjpeg -smoo 10 -qual 75 $tmpimg > $picimg");

$img_xy = GetImageSize($picimg);
$img_size = filesize($picimg);

// create thumbnail;
system("pnmscale -xy 75 75 $tmpimg | cjpeg -smoo 10 -qual 55 > $picthm");
$thm_xy = GetImageSize($picthm);
$thm_size = filesize($picthm);

// create unique file name using user_id and random characters;
// tempnam is not used so that we can include the user_id as part;
// of the filename;
$filename_seg1 = IMAGE_FOLDER.$userdata['user_id']."_";
$filename_seg1_thms = THUMB_FOLDER.$userdata['user_id']."_";
$filename_seg3 = ".jpg";
$Valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
do {
   $filename_seg2 = "";
   for ($i=0; $i<10; $i++) $filename_seg2 .= get_rand_char($Valid);
   $imgfile =  $filename_seg1.$filename_seg2.$filename_seg3;
   } while (file_exists($imgfile));
$thmfile = $filename_seg1_thms.$filename_seg2.$filename_seg3;

// save file in final location and delete temp file;
copy ($picimg, $imgfile);
unlink ($picimg);
copy ($picthm, $thmfile);
unlink ($picthm);
unlink($HTTP_POST_FILES[$iMic]['tmp_name']);
unlink($tmpimg);

==========================================================================

after all this i place the file name into mysql tables and then all done.


> 
> ----- Original Message -----
> From: <ap...@phantomcougar.com>
> To: <us...@httpd.apache.org>
> Sent: Monday, September 30, 2002 12:56 PM
> Subject: Re: [users@httpd] Error 403 on thumb directory
> 
> 
> > On Mon, 30 Sep 2002, Rich Bowen wrote:
> >
> > > On Mon, 30 Sep 2002 apachehelp@phantomcougar.com wrote:
> > >
> > > > Hello.
> > > >
> > > > I am getting 403 Errors on thumbnails explicitly stored in a thumbs
> folder
> > > > on my Apache 1.3.22 server (running under Linux Red Hat 7.1).
> > > >
> > > > I see evidence of the errors in my server logs (for a page of thumbs,
> my
> > > > users are getting 403 errors at least 75% of the time), however, when
> I go
> > > > to view the images (from my local network) they show up 95% of the
> time.
> > > > Only occasionally do I
> > > > have problems, however, I have noticed when i go to a remote computer
> I
> > > > have problems.
> > > >
> > > > I don't think it is a factor but my thumbnails are generated from a
> user
> > > > submitted image that is resized using PHP scripts and djpeg and
> pnmscale.
> > > >
> > > > My thumbs folder is chmod 775 and chowned by {me}.apache and each
> thumb is
> > > > chmod 744 and chowned by {me}.apache
> > > >
> > > > I have googled the net for the problem and asked friends but everyone
> is
> > > > surprised I am having problems based on my permissions.
> > > >
> > > > Is there any way I can find out what is causeing the 403 error or fix
> > > > this?
> > >
> > > What message is appearing in the error log when this happens?
> > >
> > >
> > Nothing in my error logs (all that shows up there are missing files that
> > are requested, but these missing files do not correlate with my 403 error
> > in my httpd
> > log).  In my httpd logs I get the follow message, for example:
> >
> > cache-mtc-al05.proxy.aol.com - - [30/Sep/2002:04:26:38 -0500] "GET
> > /thumbs/868_yTPUhaXamM.jpg HTTP/1.0" 403 301
> >
> > I doubled checked to make sure the file exists, in the thumbs dir:
> >
> > -rwxr--r-- 1 myusername apache  1425 Sep  3 00:17 868_yTPUhaXamM.jpg
> >
> > What I don't get is why this error is not consistant, and why the files
> > show up sometimes and not at others.
> >
> > Thanks for your help.  Mark
> >
> >
> > ---------------------------------------------------------------------
> > The official User-To-User support forum of the Apache HTTP Server Project.
> > See <URL:http://httpd.apache.org/userslist.html> for more info.
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> >    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Error 403 on thumb directory

Posted by Robert Andersson <ro...@profundis.nu>.
Just a thought, are you sure that the image has been completly written and
the file closed before sending the redirect or link to it? That might
explain why it sometimes work, and other times not. How does the PHP
document work?

Regards,
Robert Andersson

----- Original Message -----
From: <ap...@phantomcougar.com>
To: <us...@httpd.apache.org>
Sent: Monday, September 30, 2002 12:56 PM
Subject: Re: [users@httpd] Error 403 on thumb directory


> On Mon, 30 Sep 2002, Rich Bowen wrote:
>
> > On Mon, 30 Sep 2002 apachehelp@phantomcougar.com wrote:
> >
> > > Hello.
> > >
> > > I am getting 403 Errors on thumbnails explicitly stored in a thumbs
folder
> > > on my Apache 1.3.22 server (running under Linux Red Hat 7.1).
> > >
> > > I see evidence of the errors in my server logs (for a page of thumbs,
my
> > > users are getting 403 errors at least 75% of the time), however, when
I go
> > > to view the images (from my local network) they show up 95% of the
time.
> > > Only occasionally do I
> > > have problems, however, I have noticed when i go to a remote computer
I
> > > have problems.
> > >
> > > I don't think it is a factor but my thumbnails are generated from a
user
> > > submitted image that is resized using PHP scripts and djpeg and
pnmscale.
> > >
> > > My thumbs folder is chmod 775 and chowned by {me}.apache and each
thumb is
> > > chmod 744 and chowned by {me}.apache
> > >
> > > I have googled the net for the problem and asked friends but everyone
is
> > > surprised I am having problems based on my permissions.
> > >
> > > Is there any way I can find out what is causeing the 403 error or fix
> > > this?
> >
> > What message is appearing in the error log when this happens?
> >
> >
> Nothing in my error logs (all that shows up there are missing files that
> are requested, but these missing files do not correlate with my 403 error
> in my httpd
> log).  In my httpd logs I get the follow message, for example:
>
> cache-mtc-al05.proxy.aol.com - - [30/Sep/2002:04:26:38 -0500] "GET
> /thumbs/868_yTPUhaXamM.jpg HTTP/1.0" 403 301
>
> I doubled checked to make sure the file exists, in the thumbs dir:
>
> -rwxr--r-- 1 myusername apache  1425 Sep  3 00:17 868_yTPUhaXamM.jpg
>
> What I don't get is why this error is not consistant, and why the files
> show up sometimes and not at others.
>
> Thanks for your help.  Mark
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Error 403 on thumb directory

Posted by ap...@phantomcougar.com.
On Mon, 30 Sep 2002, Rich Bowen wrote:

> On Mon, 30 Sep 2002 apachehelp@phantomcougar.com wrote:
> 
> > Hello.
> >
> > I am getting 403 Errors on thumbnails explicitly stored in a thumbs folder
> > on my Apache 1.3.22 server (running under Linux Red Hat 7.1).
> >
> > I see evidence of the errors in my server logs (for a page of thumbs, my
> > users are getting 403 errors at least 75% of the time), however, when I go
> > to view the images (from my local network) they show up 95% of the time.
> > Only occasionally do I
> > have problems, however, I have noticed when i go to a remote computer I
> > have problems.
> >
> > I don't think it is a factor but my thumbnails are generated from a user
> > submitted image that is resized using PHP scripts and djpeg and pnmscale.
> >
> > My thumbs folder is chmod 775 and chowned by {me}.apache and each thumb is
> > chmod 744 and chowned by {me}.apache
> >
> > I have googled the net for the problem and asked friends but everyone is
> > surprised I am having problems based on my permissions.
> >
> > Is there any way I can find out what is causeing the 403 error or fix
> > this?
> 
> What message is appearing in the error log when this happens?
> 
> 
Nothing in my error logs (all that shows up there are missing files that 
are requested, but these missing files do not correlate with my 403 error 
in my httpd 
log).  In my httpd logs I get the follow message, for example:

cache-mtc-al05.proxy.aol.com - - [30/Sep/2002:04:26:38 -0500] "GET 
/thumbs/868_yTPUhaXamM.jpg HTTP/1.0" 403 301

I doubled checked to make sure the file exists, in the thumbs dir:

-rwxr--r-- 1 myusername apache  1425 Sep  3 00:17 868_yTPUhaXamM.jpg

What I don't get is why this error is not consistant, and why the files 
show up sometimes and not at others.

Thanks for your help.  Mark


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Error 403 on thumb directory

Posted by Rich Bowen <rb...@rcbowen.com>.
On Mon, 30 Sep 2002 apachehelp@phantomcougar.com wrote:

> Hello.
>
> I am getting 403 Errors on thumbnails explicitly stored in a thumbs folder
> on my Apache 1.3.22 server (running under Linux Red Hat 7.1).
>
> I see evidence of the errors in my server logs (for a page of thumbs, my
> users are getting 403 errors at least 75% of the time), however, when I go
> to view the images (from my local network) they show up 95% of the time.
> Only occasionally do I
> have problems, however, I have noticed when i go to a remote computer I
> have problems.
>
> I don't think it is a factor but my thumbnails are generated from a user
> submitted image that is resized using PHP scripts and djpeg and pnmscale.
>
> My thumbs folder is chmod 775 and chowned by {me}.apache and each thumb is
> chmod 744 and chowned by {me}.apache
>
> I have googled the net for the problem and asked friends but everyone is
> surprised I am having problems based on my permissions.
>
> Is there any way I can find out what is causeing the 403 error or fix
> this?

What message is appearing in the error log when this happens?

-- 
Rich Bowen - rbowen@rcbowen.com
Author - Apache Administrator's Guide
http://www.ApacheAdmin.com/


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org