Serving static content through PHP - bad idea?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

Serving static content through PHP - bad idea?

Post by kaisellgren »

Hello,

Does anyone have experience with high load websites where you deliver static content through PHP? I am setuping a file download site and I am serving some files through PHP. Actually I am limiting the file download speed with PHP so that it sends x bytes and then sleeps one second... this way I can effectively make more premium users, but I am wondering if this is too challenging for the processor to handle all file downloads through PHP? Or are there Apache modules that can do the same?
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Serving static content through PHP - bad idea?

Post by jaoudestudios »

Apache's htaccess file can limit the connection speed. It might be more efficient than php?
User avatar
php_east
Forum Contributor
Posts: 453
Joined: Sun Feb 22, 2009 1:31 pm
Location: Far Far East.

Re: Serving static content through PHP - bad idea?

Post by php_east »

i would imagine that to be at TCP level, not IP. if you have limited speed access from your server out, the only way is to ask your host for faster link out. I really don't think servers choke for downloads. Once triggered, the sockets do the work.
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

Re: Serving static content through PHP - bad idea?

Post by kaisellgren »

jaoudestudios wrote:Apache's htaccess file can limit the connection speed. It might be more efficient than php?
Sounds good.
php_east wrote:i would imagine that to be at TCP level, not IP. if you have limited speed access from your server out, the only way is to ask your host for faster link out. I really don't think servers choke for downloads. Once triggered, the sockets do the work.
It's not because of having a bad server. It's because I want to have a feature. VIP users should get faster downloads than guests, for instance. Just like MegaUpload, RapidShare, etc do.
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Serving static content through PHP - bad idea?

Post by jaoudestudios »

You must have a big server with a fat pipe?
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

Re: Serving static content through PHP - bad idea?

Post by kaisellgren »

jaoudestudios wrote:You must have a big server with a fat pipe?
Not me. :)
User avatar
php_east
Forum Contributor
Posts: 453
Joined: Sun Feb 22, 2009 1:31 pm
Location: Far Far East.

Re: Serving static content through PHP - bad idea?

Post by php_east »

kaisellgren wrote: It's not because of having a bad server. It's because I want to have a feature. VIP users should get faster downloads than guests, for instance. Just like MegaUpload, RapidShare, etc do.
ah, i see. you cruel beast :mrgreen:
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Serving static content through PHP - bad idea?

Post by jaoudestudios »

Your pipe and traffic must be quite big if you want to host lots of files.

I am planning on hosting some virtual server images in the near future, fedora10, centos5.2, ubunut8.10 (including latest updates). Zipped they are about 1.4GB, I am affraid that I will go over my 4TB limit each month :?
Post Reply