Up And Running
As you can probably tell if you're reading this, I've managed to get something up on the web. The site is fairly basic, but includes a couple of blog posts plus my bulldozer game. I've done the formatting with cascading style sheets (css), created a reusable page header using Server Side Includes (SSI), written some php code to help with easily adding new content, added some simple javascript, and produced a few icons plus a logo for the site. I've also managed to find a host, and register a domain name. Considering that I can only really find a couple of hours a week to work on this stuff, I'm reasonably happy with the progress so far.
Of course, there is still a lot to do. I need to sort out the formatting of the pages to make things look a bit better. I'd like to start with an email address so that I can ask for feedback on the game and website, but I might even move on to writing a comments system so that people can comment directly on articles. My workflow for adding content relies on copying and pasting large chunks of html by hand into the new pages; I'd like to find a nice way of automating this both to make the process easier and to allow me to apply changes to all the pages easily. There's also a lot of work to be done to finish off my game.
Finding A Host
There are lots of hosts around - many seem to offer the same sort of deal with unlimited storage and downloads for two or three pounds a month. At the moment, there isn't much to attract people to this site, or much data to store on the server, so I decided that my needs would be met by a free host. I had to pay a bit for domain name registration, and a one off setup fee. For about £28 they registered my domain name, and set up a server for me. I will need to pay more in a years time to renew the domain registration, but the hosting is free from now on. There are limits of 100MB on the storage that I can use, and 100MB per month on downloads from the site. The download limit seems quite low to me, but I don't think this will be an issue for the moment as I don't expect much traffic through the site.
Registration was easy, and I quickly got a set of emails giving me details of login for ftp access, cPanel, and client account on the web site.
The low download limit reminds me that I really need to spend a bit of time looking at optimising my site. None of the assets that I've produced are huge - I've generally limited images to a couple of hundred pixels in width and height - but now that I'm getting a better idea of how I want things to be laid out I should be able to fix things to be even smaller so that I'm using less bandwidth with each server request. I also need to find out some more about browser file caching. As I understand it, .shtml files are not cached by default, so browsers will request my pages each time they are viewed. The pages don't change very often - or in some cases at all - so they are ideal candidates for caching to reduce bandwidth usage.
Server Problems
So, I downloaded a free ftp client and uploaded the files I'd been working on locally. On my localhost, everything worked fine. On the internet, things weren't so fine.
The first signs of a problem came just after I'd uploaded all my files. I'd made a slight change to something and wanted to overwrite the file on the server, but I couldn't get the ftp connection to work. It was late, so I gave up for the night and went to bed, assuming I'd be able to work out what I was doing wrong the next day. When the next day came, it became clear that I wouldn't be able to solve the problem myself. I couldn't connect to the server via ftp, or via http through a browser. I went to my host's help centre on the internet to post a support query, and noticed that there was a message there saying that the server had crashed, and they were trying to fix it. Not a very promising start.
The server was back the next day, however, and as far as I can tell it hasn't been down since. So, I'll put this down as a temporary blip.
The actual process of uploading my files was actually a bit more complicated than it needed to be. I have been developing the site on my local host for a while now, and naturally there are various old and no longer used files sitting around in the directory tree, along with other tests and experiments that were never meant to be part of the production site. Selecting the files to upload, ensuring that I don't fill the server with unnecessary stuff but do get all the essential files in place isn't a very streamlined process at the moment. I need to come up with a workflow that will allow me to automate this process as much as possible, or at least test what I'm about to put onto the live server locally before uploading it. It would be nice to include source control into that workflow, so that I don't risk losing important files. If the source repository was hosted on a remote server somewhere then I would be protected from losing data in the event that the hard-drive on my laptop falls over.
Configuration Problems
So, the site was up and some of my pages were accessible through a browser. Some of the pages didn't quite look right though. The main page, and the index pages for my blog and game sections were missing the links to the actual content. I had a site, but only the headers of the pages could actually be seen. I could see that the content was available from the server, because I know what files are there I can type the addresses into the browser address bar manually. Anyone else visiting the site, however, would not know where to look.
The index pages are generated on the server whenever a page is requested through a php script. That script is included into the .shtml source for the pages using SSI. I had also used SSI to include the header for the pages, so I knew that SSI was functioning to some extent, but it was not correctly running the script to generate output. Instead, all I had was a fairly unhelpful message from the server saying '[an error occurred while processing this directive]'. So, I sent off a support request to my host, and set about trying to work out what was wrong.
After a bit of searching around on the internet, I discovered that Apache server can have two different modes for allowing SSI. When I set up my local server, I had turned on SSI by adding the 'Includes' option to the 'Options' directive. It turns out that Apache also supports the 'IncludesNOEXEC' option, which will enable SSI, but not allow it to run any scripts that are included in a file. This is exactly the behaviour I was experiencing, so I assumed that the server of my host was configured using this directive. I don't have access to configuration of the server that my host has set up, but fortunately Apache will allow the configuration to be changed on a per-directory level by using a file called .htaccess. This file is parsed by the server before it serves any files from a directory, and it can override some of the server's configuration. The .htaccess file can give you the power to make your server do lots of interesting things even if you don't have access to it's default configuration. I added a .htaccess file to the directories that needed SSI with script execution containing the single line:
Options += Includes
and my script execution problems were solved.
Operating System Problems
Actually, my script problems weren't quite solved. The script was working correctly on my home page, but the blog and games index pages were still not being generated correctly. Again, all the server would tell me was that .[an error occurred while processing this directive]'. I was happy to have made some progress though, so I gave up for the evening and went to bed, after updating the support request I'd submitted to explain that part of the problem was solved.
The next day, when I found some time to look further into the problems, I was pleasantly surprised to find that the support team had found a solution while I was away. The engineer who looked into the problem had not only identified the problem, but fixed it on the server (and saved a backup copy of the original file that he had to change to implement the fix). My local test of the site is running on my windows laptop at home, but the hosted site is running on some flavour of Unix. Windows has a case-insensitive file system, meaning that when I included 'makeTable.php' it found the file I wanted, which was named 'maketable.php'. On the Unix machine, however, the filenames didn't match because the file system is case-sensitive. So, I fixed up the other couple of instances of filenames not matching, and everything was running just as it was at home.
Everything's Rosy
So, as far as I can tell, everything is working properly now. Random people from all over the world can now read my inane ramblings. What more could anyone ask for?