hostglory Posted January 3, 2006 Share Posted January 3, 2006 I'm in a major fix right now. I need to display multiple (20+) images from a Blob field in MySQL on a single web page using PHP. The problem arises when I get a 403 forbidden error, which can only mean one thing, too many database connections at one time. I have tried closing the MySQL connection each time I need to display each image, but I'm still getting this error! If anyone knows how to display multiple images from a Blob field on a single web page with PHP, without getting this error, I could really use your help! Quote Link to comment Share on other sites More sharing options...
fenway Posted January 3, 2006 Share Posted January 3, 2006 I don't understand exactly what you mean... how are you storing 20 images in a single BLOB field (or did I miss the piont)? I'm not sure why you think 403 means too many connections, either. Also, how would retrieving 20+ images require multiple DB connections? Or each each image calling it's own PHP script? Please clarify. Quote Link to comment Share on other sites More sharing options...
hostglory Posted January 3, 2006 Author Share Posted January 3, 2006 [!--quoteo(post=332696:date=Jan 3 2006, 03:35 AM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jan 3 2006, 03:35 AM) 332696[/snapback][/div][div class=\'quotemain\'][!--quotec--] I don't understand exactly what you mean... how are you storing 20 images in a single BLOB field (or did I miss the piont)? I'm not sure why you think 403 means too many connections, either. Also, how would retrieving 20+ images require multiple DB connections? Or each each image calling it's own PHP script? Please clarify. Â Â No, let's say I have 20 images, then there would be 20 different rows, one row for each image. I'm calling the images using this method: <img src="getpicture.php?id=1234"> Â Then, in the getpicture.php script, I connect to the database, grab the blob data for that single image, then change the header type and then print out the image. Hopefully this clarify's what I'm trying to do. Quote Link to comment Share on other sites More sharing options...
fenway Posted January 3, 2006 Share Posted January 3, 2006 That's what I thought, it just wasn't clear from your initial post. It seems strange that your DB wouldn't allow 20 simultaneous connections, but it's possible. Quote Link to comment Share on other sites More sharing options...
hostglory Posted January 3, 2006 Author Share Posted January 3, 2006 [!--quoteo(post=332802:date=Jan 3 2006, 12:25 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jan 3 2006, 12:25 PM) 332802[/snapback][/div][div class=\'quotemain\'][!--quotec--] That's what I thought, it just wasn't clear from your initial post. It seems strange that your DB wouldn't allow 20 simultaneous connections, but it's possible. Â Â I looked at the MySQL configurations, and it is set to allow 20 max user connections. But, I'm just wondering if there could be anything else causing the 403 error. And, is there a different way to accomplish this without having to make so many database connections? Quote Link to comment Share on other sites More sharing options...
fenway Posted January 3, 2006 Share Posted January 3, 2006 Twenty isn't that many to begin with, but no, if you're going to make 20 images on a page, each retreived via script, then you don't have much of a choice without a whole bunch of undesired hacks. To be honest, there's nothing wrong with 20 connections, as long as each of them isn't doing that much work. In your case, if it's just getting and image and disconnecting, it shouldn't be an issue. BTW, I don't see how this is causing 403 errors; those are web server errors, usually related to permissions, and shouldn't have anything to do with PHP/MySQL-related issues -- the worst you should get would be a timeout. Quote Link to comment Share on other sites More sharing options...
hostglory Posted January 3, 2006 Author Share Posted January 3, 2006 When I get the 403 error, it's usually after I've tried refreshing the page again. The first time the page is displayed it will only produce a 1/4 of the images. I try to refresh, and then it gives me the 403 error. So it's hard to understand what's causing it to produce that error? Quote Link to comment Share on other sites More sharing options...
hostglory Posted January 3, 2006 Author Share Posted January 3, 2006 Could it be possible that I'm maxing out my Apache connections everytime I try to display all these images? Quote Link to comment Share on other sites More sharing options...
fenway Posted January 3, 2006 Share Posted January 3, 2006 That seems highly unlikely, because it would mean that you couldn't have 20 images on a page either! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.