Tuesday, December 5, 2006

Hosting A Web Site

Hosting a Web site can be complicated. You need to choose a platform to host, compare prices and sift through disk space offerings. This blog will help you to make up your mind through some tough decisions.

Choosing A Hosting Platform

Once you decide that you want to set up a Web site, the very first step you need to look at is buying a domain and checking out the hosting options available to you. Where you buy the hosting from is secondary right now, as the major decision depends on what type of hosting you need and the platform (Windows or Linux), on which you need to host.

The first step in this exercise is to decide the contents of your site, and understand the limitations of each platform and the costs involved.

The simplest, and cheapest, option is to opt for Linux hosting running a PHP/MySQL site that will give you the database driven online presence you need and also some cool options for automatically setting up a site. Using PHP-Nuke, you can set up a site for only the cost of the domain name and Web hosting.

Other than a PHP/MySQL site, you can choose to set up a simple HTML site or choose the Windows based ASP platform. With an HTML site, you will only get a lot of pages that are linked to one another. Moreover, reading data from a database or allowing users to enter data such as feedback on your site will become a problem. Simple HTML pages are generally best left to the average personal Web site.

ASP runs on a Microsoft Access Database, and is much simpler to use than MySQL, because it has that familiar Windows look and feel, and integrates beautifully with existing Microsoft programs and OS's. At the sme time, making an ASP site can be a daunting task for those who have just basic familiarity with Web programming. Another plus point for PHP-based sites is that the PHP platform is Open Source, and thus, Web site starter kits such as PHPNuke and PostNuke are freely available, with tons of support from a huge community of developers and Web programmers — all for free!

Requirements

Once you have decided on the platform (ASP or PHP, Windows or Linux), the next step is to understand the type of account you would like — space-wise. You can get cheap hosting accounts with as little as 15 MB of space (for plain-jane HTML sites), or really expensive dedicated servers located in an ISP's data centre (if you plan to run something like Microsoft.com!). Finding the right balance is what matters.

Ideally, you should design your site first and then decide on your hosting by gauging the size of the files you have and the amount of visitors you are expecting.

However, since we recommend a PHP-Nuke or PostNuke site for a simple and quick small Web site set up, you will need to buy the hosting first. This is because you need to modify PHP-Nuke or PostNuke while they are live—though you could do it on your own computer, and port the data and database entries to your actual hosting provider’s server later, it defeats the whole ‘quick and easy’ idea of using these software in the first place.

So how much space should you opt for? There’s no point in investing in a dedicated server right away, so you can rule that out. Also, depending on your site’s goal — whether you plan to use your site as a personal site or one that promotes a company or products through marketing and sales—you can safely rule out any free options or really low-end providers. See the following example: Let’s say you decide on a site, say, www.YourDomain.com, and buy the domain from GoDaddy.com. You could choose to buy the “Economy” hosting pack, which gives you 500 MB Web space, a 25 GB bandwidth limit and 100 e-mail addresses with POP3 and Web mail access. Well, not bad for a start!

Considering that the average site will not cross 100 MB, including images, brochures and a limited number of downloads, GoDaddy’s Economy plan should give you a good benchmark of what you can expect. The plan costs about $4 per month, or approximately $48 per year only. "But what if I have a 24x7 Internet connection, and want to host my site on my own computer?"

Hosting Your Own Site

If you have a decent computer that can run steadily for really long periods (in excess of a month at a stretch), you could host a low requirement site on a standard 128 Kbps cable connection from your home or office.

Hardware Requirements

You can always choose to host your own server, especially if you have an Internet connection and hardware availability. While, it would be all too easy to suggest a neat dual-server-CPU-based solution, the purpose of cost saving by hosting your own site would be defeated. Here, we shall consider only the basic requirements for hosting a small Web site by yourself.

You can visit http://www.zdnetindia.com or http://www.bandwidthplace.com to find out how fast your connection is, and then decide whether you will be able to host your site on your own computer. You don’t need to set up a data centre to host a Web site. Even a company Web site can be hosted on a normal desktop PC—provided you have a good Internet connection and a decent UPS

The first thing you need to look at is your Internet connection. There’s no point hosting a site if your 'broadband' connection is one of those limited MB or GB connections. Web sites can consume a lot of bandwidth, especially your upload bandwidth, and since many ISPs count both the upload and download usage towards your billing, hosting your own site might not be a wise decision.

If you have an always-on connection, remember that not all ISPs provide you with a 1:1 ratio of upload to download bandwidth. So even if you have a 256 Kbps connection, it might be limited to 128 Kbps or less for upload speeds.

Even for a very small site, say, one that gets only a couple of visitors at a time, an upload of 128 Kbps is bare minimum. So make sure your connection meets this very basic requirement before you think of hosting your own site.

In terms of hardware, it is advisable to first see what you have lying about. In order to start a Web server, you will need a fully functional computer, with or without a monitor. Depending on the OS you select to run the server on, your requirements will vary.

For example, if you plan to run a server on Windows XP, you will need at least a 1 GHz CPU with 256 MB RAM and a 20 GB hard disk.

If you are comfortable with Linux or one of its cousins, you could always choose not to install a Window manager such as KDE or GNOME and run everything through a command line. This would bring down the requirements of the system to a 500 MHz CPU, 256 MB RAM and a 20 GB hard disk.

Of course, people still have Web servers running on 133 MHz CPUs with 128 MB RAM, running older versions of command line Linux, so there’s really not much limitation in terms of hardware. Due to the popularity of the Windows platform, we will stick to a recommendation of at least a 1 GHz CPU, minimum 256 MB RAM (512 preferred) and a 20 GB hard disk.

Setting Up The Server

The most preferred servers are still Linux, but only because a Web server running Windows NT or Server 2003 will burn a hole in your pocket, at least initially. Since Linux is the free option (and we’d rather not consider the ‘free’ Windows option that the local software pirate will hand you), we’ll stick with it for now. Of course, you could always decide to purchase Windows Server 2003, or just run the Web server on your existing operating system- Linux/Unix/BSD, Windows XP/2000/Me/98.

Since Windows XP Professional comes with Microsoft’s Internet Information Services (IIS), which also has an in-built Web server, you could choose this to run an alternative ASP-based Web site. Of course, you can still choose to use Open Source software such as the popular Apache Web server (http://www.apache.org) to host your site.

Since we’re looking at the cheapest solutions to minimise the costs you have to incur when starting up a Web site, we will stick to Open Source software and freeware.

If you have decided to use Apache for a PHP/MySQL-based site, the first thing you need to do is download Apache from http://www.apache.org. Make sure to choose the latest Win32 Binary. You will find a list of Mirror sites to download Apache from at http://www.apache.org/dyn/closer.cgi.

Install Apache and configure the httpd.conf file located in the install-root/conf/ folder. Here the default install-root is “C:\Program Files\Apache Group\Apache2\”

So, if you do a default install, the path is “C:\Program Files\Apache Group\Apache2\conf”. Also remember that when changing settings in the httpd.conf file, all backward slashes for paths should be changed to forward slashes, for example, the ServerRoot path line should read:

ServerRoot “C:/Program Files/Apache Group/Apache2”

(if the path is given as “C:\Program Files\Apache Group\Apache2” Apache will not work properly!) If you have any problems installing Apache, please read their online help guide available at http://httpd.apache.org/docs/2.0/.

The next thing you need is PHP. You can download the latest version from http://in.php.net/downloads.php. If you are running Apache as the server you should download the ZIP package. If you are just installing PHP on your inbuilt Microsoft IIS server, you can just download the small installer package.

Just remember to choose the correct Web server option during the install (as shown in the screenshot alongside).

Once you have downloaded the package, unzip or install it to your hard drive and then make sure to read the INSTALL.txt file fully. If there's something you do not understand, go to http://in.php.net/manual/en/ to read more about the installation procedure. The full installation guide is available at http://in.php.net/manual/en/install.windows.manual.php

The next thing you will need to do is get MySQL from http://dev.mysql.com/downloads/mysql/. Downloading from this URL will make sure you choose the latest stable release. However, if you want to try the latest Beta, or even older installations you can go to http://dev.mysql.com/downloads/.

Make sure to put the right information in when installing Apache, and you will have a Web server up and running in no time.

Always remember to carefully read and understand the installation and configuration instructions for all three software (Apache, PHP and MySQL). The smallest error will cause nothing to work, and blood pressures to rise!

EasyPHP is a program written for those who do not want the headache of setting up a server with PHP and MySQL support. You can get it at http://www.easyphp.org/.

All you have to do is download it, install it and choose a name for your database and your server is ready. If you are installing PHP-Nuke or PostNuke, put that database name and other MySQL configuration data into their configuration files and you’re set to go. Just remember to put all your site files into the ‘www’ folder which is, by default, located at “C:\Program Files\EasyPHP1-8\www\”.

Professional Hosting

The more common choice is to choose to host your site on a hosting company’s servers, as this is much easier and you don’t need to maintain servers. Besides, a hosting company can afford much better hardware and bandwidth than you ever could, and has trained professionals managing their servers.

If you take the time to search, you can find numerous good offers for Web hosting on the Net, with a lot of hosting providers. You can also just choose to host your site with your registrar (the place you buy your domain from).

For example, as mentioned earlier, if you buy a domain from, or even host one at, GoDaddy.com, you can get 500 MB Web space with a 25 GB data transfer limit and 100 e-mail IDs with both POP3 and Web mail access for just $3.95 a month!

What hosting provider you eventually choose depends solely on your needs and budget, but you should definitely try and find user reviews. There’s nothing better than getting feedback from people who actually use a company’s services, and Web hosting is no exception!

Registrars such as GoDaddy.com offer great Web hosting starter kits, and even throw in 100 email IDs with 5 MB space per ID, POP3 and Web mail access. They also offer 500 MB Web space with a 25 GB data transfer limit for a mere $3.75 a month. The only drawback is that you have to have a credit card!

Building A PHP-Nuke Web Site

PHP, the open source alternative to Microsoft's ASP, is the obvious choice to build a Web site. Why? Because it's cross-platform-a PHP site can be hosted on any Web server, running any OS, unlike ASP, which needs a Microsoft OS-and because it's open source. The biggest advantage of open source software is the thousands of developers who dedicate time to improve or simplify such software. PHP-Nuke is one such product of dedicated developers who decided that people shouldn't need to know how to code in order to develop their own PHP-based Web sites.

There are many offshoots of PHP-Nuke, which is the beauty of open source, and these are listed in the box “Options”. The installation and control panel of each does not logically differ much from PHP-Nuke, so you can feel free to experiment with some of them as well. Here, however, we will stick to PHP-Nuke, and learn how to install, configure, and finally, tweak it to give you a Web site that's unique and looks exactly like what you want it to look like.

Pre-requisites

There are some things you will need to have before you can begin setting up your site, such as a domain name and hosting space on a Web server that supports PHP and MySQL databases. Both these are relatively easy to find. On GoDaddy.com, for example, a .COM domain will cost about $9 and basic hosting with 25 GB data transfer and 500 MB Web space will cost about $4 a month. This brings your total yearly expenditure to about $57. But remember, this is all you will have to pay.

Getting PHP-Nuke

Once you've bought your domain name and Web hosting, the next step is to download the PHP-Nuke installer from http://www.phpnuke.org. The latest version will cost you $10 to download, but they offer the previous version for free download. So, as of the writing of this blog, if the latest version is 8.0, you can download version 7.9 for free. The latest free version is available at http://www.phpnuke.org/modules.php?name=Downloads&d_op=viewdownload&cid=1.

Installing PHP-Nuke

Once you have downloaded the file, unzip it to your hard drive. You will see three folders-'html', 'sql' and 'upgrades', along with multiple text files. Since you are freshly installing PHP-Nuke, all that concerns you is the 'html' and 'sql' folders. The 'upgrades' folder is meant for those of you upgrading PHP-Nuke to the latest version. The first thing you should do is read the 'Readme' and the 'Install' text files, as you should do before preparing to install any software.

Now all you have to do is follow the step-by-step instructions below to install PHP-Nuke.

Step 1: Creating A New MySQL Database

A MySQL database is what a PHP Web site uses to store data. It reads the MySQL database and displays content, and the settings that you select. When you sign up for Web hosting, you will be told how to control your databases. Most hosting companies offer a simple phpMyAdmin or mysqladmin front-end for managing your databases.

You will have to create a database here and call it anything you want. Now you will have to use the phpMyAdmin or mysqladmin front-end to create the hundreds of tables and thousands of fields in MySQL that PHP-Nuke needs. Fortunately, all you need to do is find a link called SQL.

Step 2: Adding PHP-Nuke tables To The Database

Once you click on the SQL link, there will be an option to upload a file to the server and run the SQL commands in it. Basically, you need to upload the file called 'nuke.sql' which is in the 'sql' folder you came across after unzipping the PHP-Nuke installer.

There will be a button titled 'Choose', which will ask you to select a file from your hard disk. Select the file 'nuke.sql' and click 'Go'. This will execute all the required SQL commands, and you can now begin uploading your Web content.

Step 3: Editing The config.php File

In the 'html' folder, you will find a file called config.php. Open this with a text editor such as Notepad or Wordpad. You will see the following lines:

$dbhost = “localhost”;
$dbuname = “root”;
$dbpass = “”;
$dbname = “nuke”;
$prefix = “nuke”;
$user_prefix = “nuke”;
$dbtype = “MySQL”;
$sitekey = “S·kQSd5%W@Y62-dm29-.-39.3a8sUf+W9”;
$gfx_chk = 0;
$subscription_url = “”;
$admin_file = “admin”;
$advanced_editor = 0;

These are the default settings, and you will need to change these. An explanation for each field is given within the config.php file itself. The important ones you should take special care when
changing are:

“$dbhost = “”;

Set this to wherever your MySQL database is hosted. With GoDaddy hosting, this is generally something like “mysqladmin99.secureserver.net”. If you are sure that the database is hosted on the same machine as the Web server, then leaving this to “localhost” should be fine.

“$dbusername = “”;

Here, is the username you set with your hosting provider for database management.

“$dbname = “”;

Here you should enter the name you set in Step 1 for your database.

“$admin_file = “admin”;

If you want to change the name of the admin.php file to something else, say “big-boss.php”, for obvious security reasons, then you should change this setting to reflect that ($admin_file = “da-big-boss”;). Make sure that this setting and whatever you rename the admin.php file to always match, or you'll end up with a non functional site.

Step 4: Uploading The Site

Now you're finally through with all the actual editing and changing. All you have to do is upload all the files, as they are, to your Web server's root directory. This will take a while, and may fail frequently on slower connections. It would be best to find an FTP utility that supports resume and allows you to upload folders and keep folder structures. If you have a decent connection, Internet Explorer will do just fine.

Once everything is uploaded, just type in your domain in a browser and you will see a message on the main page that tells you to create an admin account and set a password. Once this is done, you will be logged into the Administration Control Panel (ACP). This is where you will be able to tweak your site and its content-all from within your browser.

Step 5: Understanding The PHP-Nuke Layout

Once you've gotten all the above steps right, you will have reached the Administrative Control Panel (ACP) for your PHP-Nuke Web site. Now, before you can start building your site, you need to know what each little icon in your ACP means, and how you can leverage them within your site.

Since we cannot list all of them in detail, we will cover the most important ones here. You should be able to decipher the rest easily enough by clicking on them.

Preferences

This is where you set all the important settings of your site, such as the name of the site, the logo it uses, the theme or colour of the entire site, and all administrative information and settings. Make sure to set all the correct information here first. You should also check out the different theme options that come bundled with PHP-Nuke and decide on one that suits your site best. You can always tweak the design later, or even download a PHP-Nuke theme from the thousands available online.

Blocks

Blocks are just that-blocks! The different boxes you see around the default site that you already have are its blocks.

From the ACP, you can control which blocks are shown on your site, and more importantly, where on the site they appear. You will see the following details mentioned: Title, Position, Weight, Type, Status, Visible To, and Functions with Edit, Activate/Deactivate, Delete and Show options. So, for example, let's say you want to move the Login block to the left of the Web site and disable the Languages block:

First, you click on the Edit icon in line with 'Languages'. In the new page that loads, you will see that you can change the option for Activate to 'No'. This will deactivate the Languages module, and you should also set the 'Visible to Subscribers' option to 'No', to hide the Languages block. Now, just edit the Login block the same way, and just set the value of “Position” to “Left”.

Now you can go ahead and play about with the blocks to see what you want where and what you want to remove. You can also create new blocks, with links to new pages that you construct. It's really very easy once you do it yourself.

Modules

Modules are like functions of your Web site, and can be controlled easily using the ACP. Clicking on the Modules link takes you to a page with a long list of modules. Here you have to choose what's important for your site to have and what isn't. Remember, there has to be at least one module linked to your home page. By default, this is set to the News module, as PHPNuke was primarily built for community boards. You can change this to anything else, and you can also download and install more modules from the Net.

By default, the following modules are active after you install PHP-Nuke:

AvantGo, Downloads, Feedback, Journal, Private Messages, Recommend Us, Search, Statistics, Stories Archive, Submit News, Surveys, Top 10, Topics, Web Links, Your Account.

The easiest way to learn what each one is, is to click on the link and see where you go. It's all pretty straightforward.

Messages

The default message you see in your home page is listed here. Messages are sort of like posts that get priority over everything else in the home page. They can be set to be permanent, such as an introduction to your site, or temporary, such as informing site visitors that the downloads section will be down for a week. You can also have messages only for registered users, or other administrators, etc.

Step 6: Investing The Time

Though this will only get you started with your Web site, PHP-Nuke is built to be easy to understand. Even if you do come across problems, or cannot understand something, there are hundreds of forums that discuss and solve any questions or problems that people face.

In the end, how well designed and snazzy your site looks depends solely on the amount of time you can dedicate to it. You can also add a shopping cart and a payment gateway, and sell your goods online. The options are unlimited, especially with PHP-Nuke modules, which seem to be made for each and every function you could ever imagine. Building your dream site is a lot easier now-all it takes is some time, the right keywords in Google, and a little bit of bandwidth!