hoyles Posted July 16, 2008 Share Posted July 16, 2008 Hey all... :-\ I own and operate www. t i n y a l b u m .com. I recently acquired it and keeping it online has been troublesome since the traffic and size of the site just exploded in the first 30 days. The site now sites at over 1500 members with over 49,000 images posted. The traffic actually crashed my server - repeatedly - so I had to upgrade to a new machine, but I didn't upgrade enough, because it's still chugging and taking up 90% of my memory in no time. The site is basically just php & ajax and the cool part is that there's no limit on uploads and the script is designed to retain your original photos (because most hosts script them down to fit a specific size, etc). My question is how can I keep this site online without any more server issues? It's been weeks now and I can't keep it online for more than 3-4 days without an issue. My current server is a Linux machine - an Intel Core Duo 2.13 with 2gb ram and it's running CentOS 5. Please help. Quote Link to comment https://forums.phpfreaks.com/topic/115076-hosting-nightmare/ Share on other sites More sharing options...
LooieENG Posted July 16, 2008 Share Posted July 16, 2008 Go through your code and optimise it? i.e. using as little code and as few SQL queries as possible? Edit: Also look into caching? Quote Link to comment https://forums.phpfreaks.com/topic/115076-hosting-nightmare/#findComment-591775 Share on other sites More sharing options...
hoyles Posted July 16, 2008 Author Share Posted July 16, 2008 Not quite sure why my thread was moved to Misc... I'm looking for a php solution to process massive amounts of images (almost 50,000) and keep my site online while I have 1000 simultaneous connections... Anyways... thanks for the tip Looie - I've optimized it the best I know how, and I have a PHP developer who eats, sleeps and breathes code. The biggest issue with the site is that it doesn't index uploaded images into a database, it puts the image into a folder on the server and serves it back to people that way. To change that now would take forever and jeopardize the current member base / albums already there. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/115076-hosting-nightmare/#findComment-591777 Share on other sites More sharing options...
Daniel0 Posted July 16, 2008 Share Posted July 16, 2008 If you are serving the files dynamically, then you should not load the entire file into a variable at once. It's better to send it in chunks to the user. It sounds like that could be the problem seeing as your script is using a lot of memory. Edit: To show what I mean, here is a small example script: <?php $file = 'file.txt'; if ($fp = fopen($file, 'r')) { header('Content-Type: application/force-download'); header('Content-Length: ' . filesize($file)); header('Content-Disposition: filename=' . basename($file)); while (!feof($fp)) { echo fread($fp, 1024); } fclose($fp); } else { echo 'Sorry, the file could not be found...'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/115076-hosting-nightmare/#findComment-591779 Share on other sites More sharing options...
The Little Guy Posted July 17, 2008 Share Posted July 17, 2008 So, you don't store the link location to your images in a database? To optimize your site, you will need to do that. Quote Link to comment https://forums.phpfreaks.com/topic/115076-hosting-nightmare/#findComment-592183 Share on other sites More sharing options...
waynew Posted July 28, 2008 Share Posted July 28, 2008 Upload your files to a directory and store the link to that file in the DB. Quote Link to comment https://forums.phpfreaks.com/topic/115076-hosting-nightmare/#findComment-601627 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.