Make sure you have the right hosting
10th June 2010
At Zoomba, we do a lot of work for other website design companies and specialise in custom content management systems. In the past week we have seen another two issues with well known hosting companies, and one which took quite a while to debug...
When your website is being developed, it is usually done "in-house" on the developers own servers or somewhere online that is password protected. The servers that are hosting your website during this development stage are owned/rented and run by developers. This means that 99% of the time they are configured correctly, or in accords with your needs.
When development of your website is complete, you then have the question of where you are going to host the live website. While this might seem like a straight forward question, it can actually be quite a complicated one.
Overall, there are tens of thousands of web hosting providers and nearly all of them look like they provide the same services on the surface. This leads many people to fall into the trap of looking at cost alone when purchasing their hosting.
For example; You may have been told that you need Linux instead of Windows Hosting and that PHP, Apache and mySQL need to be features of your hosting package. But these features will be listed by nearly every hosting company you look at!.
So what's the problem?
The problem is that each of these main features have many sub-features and some which require careful configuration on a per-website basis. Nearly every host you can find will provide PHP with their hosting packages but PHP has quite a few different versions and can further change (quite considerably) across hosts according to the individual configuration.
With PHP as an example feature:
You can imagine a website that is for photography, an ecommerce store online or another type of website that requires the ability to administer collections of images. As an administrator logging into your CMS (Content Management System); you should be able to add a new product to your website without issue.
When you take a picture with your camera, the file created is directly related to the quality and megapixel capabilities of your particular model. With the modern cameras today boasting 10 - 15 megapixels, these files can be quite considerable in size. You can imagine the time it would take a customer to open your products web page if these files were used directly!
Instead, when you upload an image. It is loaded into memory with PHP, manipulated, resized and then saved to your web server, note that quite often the original image is also discarded. In one upload, this process can create 3 or 4 different sizes of images to use throughout your website.
To be able to manipulate images when you upload them PHP needs to be configured correctly on your host. One small part of this configuration is that the PHP memory allocation needs to be sufficient.
Many "cheap(er)" hosting companies try to cram as many websites as they can onto the one server. This means that all of the websites on this server are sharing the CPU, Memory and Hard Drive space as well as many other resources. To make sure that no single website "ties up" these resources and slows down the web server for the other websites, the per-website resource allocation is often reduced to a crippling level.
Limiting resources is actually quite a big problem and we have came across this many times.
One example of us coming across this problem is here;
http://faq.1and1.com/scripting_languages_supported/php/index.html and the article "Can the memory usage limit be increased on shared hosting with a php.ini file?".
Now, considering that no image taken by your camera is likely to exceed 6mb and probably more around the 3mb file size; 40mb might sound like a generous allocation of server memory for PHP to do its business.
However, If you imagine the scenario presented earlier where you might log into your content management system to add a new product to the website, and upload the image you want to associate with it. In order to resize and manipulate the image, PHP loads the image into memory which is where the problem lies. In memory the image is actually represented as many times the file size. (for e.g. a PNG file that is 2mb may expand to 50mb of server memory!).
With the limit of 40mb applied here, adding a new product which included an image over 1.5mb in size would just hang with no error message (under PHP4), enabling PHP5 for this host allowed us to see the error message that there was not enough memory.
Then, after many hours of debugging and attempting to set the memory limit via the php.ini file, htaccess and cpanel (hosting) configuration. It was found to be a restriction put in place by the host.
So, as you can see. It is not always clear which sub-features or limitations are in place and it is worth doing your research first. If in doubt, ask your development firm to check over your host first.
Don't be fooled by large companies and cheap(er) hosting, as the saying "Too good to be true" often stands firm. Always stick with your development firm if they offer you hosting (after all they know what you need) or ask your development firm to look over your chosen hosting package.