Article
Complete Guide To Hosting - Part 2
6. File Support
You would expect all Web hosts to support the basic file types that are essential to the running of the most basic Website -- after all, if a server doesn't know how to deal with a HTML file and the images associated with it, then just how old is it? However, you cannot upload a file to a server and simply expect it to work first time. Not all servers know what to do with different files, and a server may even confuse some of the more common file types if it's not set up correctly.
Problems may become apparent when you want to use any filetype other than your typical HTML, JPEG and GIFs. Even something as simple as a Cascading Style Sheet can cause problems if the extension associated with it (.css) is confused for the lesser common mime type of Corel Slide Show.
File Extensions
How your server deals with various extensions will depend on the software its running. On Windows systems, extensions are mapped to the application they are intended for. So a file with a .pl extension is opened with the Perl Interpreter, which then outputs the page according to the contents of the file. On a *nix system, the same .pl extension is not important: you'd have to explicitly give the path to Perl in the first line of the script for the server to be able to know what program it should use to run the file.
When a server doesn't know how to deal with a file, it does one of two things:
- tries to open the file as plain text, or
- tries to download it.
These default behaviors are usually undesirable, particularly if you want the file to be sent "as is" so that your browser and its plug-ins can deal with it themselves. It also poses a possible security threat should anyone in the process of downloading a file (for example, one of your scripts) see the paths and (sometimes unencrypted) passwords stored in them.
It's a good idea to test how your server deals with various file types before you go uploading anything that contains potentially sensitive content or source code. If the file types you use aren't supported in the way that you'd like, it could simply be that the file extensions aren't associated with the correct mime types. Depending on your host and server setup, you may be able to add your own mime types. This would even allow you to create your own file extensions and make people wonder just what sort of scripting language you use!
Mime Types
It must be stressed that not all hosts will offer you the opportunity to add your own mime types, so it's a good idea to make sure that the server supports all the file types you plan to use.
If your host is running Apache, then you may be able to edit the Apache handlers and have files behave like something else entirely different. It is certainly possible to make an .html file parse server side includes by editing the handlers in this way.
However, unless you need to parse all your files for includes, it's probably not worth it, as this will cause all .html files to be parsed before they're sent to the browser, which will put unnecessary strain on the server.
7. Scripting Magic
While it is possible to install pretty much any kind of Web technology into any server setup, you will find that some combinations of server and scripting languages work better than others. So let's look at the more common Web technologies and discuss how they're affected by various server environments.
Perl
Perl has been around long enough to have wide support across many server platforms, some modules being specific to certain builds of Perl depending on the server operating system. It would certainly be worth taking a look at the operation of specific modules if you intend to make use of them. To minimize the problem of cross platform inconsistencies, consider developing your Perl scripts in the same sort of environment as the live server you will eventually upload them to, particularly if you use system-specific functions or modules.
Out of all the possible scripting languages available today, Perl is the most frequently supported by hosts that offer scripting capabilities. Unless you utilize system or server specific modules, your use of Perl should not restrict your choice of host.
Perl is particularly suited to running on an Apache server, and Apache modules such as Mod_Perl have been designed to speed up the execution of Perl scripts. The Windows version of Perl is know as ActivePerl, and while Perl will run happily on a Windows machine there are a few subtle differences with some functionality.