Jump to content

Recommended Posts

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.  :(

Link to comment
https://forums.phpfreaks.com/topic/115076-hosting-nightmare/
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/115076-hosting-nightmare/#findComment-591777
Share on other sites

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...';
}
?>

Link to comment
https://forums.phpfreaks.com/topic/115076-hosting-nightmare/#findComment-591779
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.