Note before: This is an old “Diary Entry” from the Modem-Help site, re-jigged into the etmg format. The original site is now long gone.
Sometime back in May I received an e-mail asking me, incidentally, whether the site was Database-driven. My reply was a little flippant, saying that I was foolish enough to construct all pages by hand, but this question planted a seed in my mind which has brought forth fruit 3 months later, with a decision to re-construct the whole site as a server-side Database-driven application.
I think most people find the decision-making as the easy bit, with the follow-up as the hard bit. Personally, I find the decision-making to be the hard bit. Making the decision good is then just normal hard work.
Whatever, as the following months are going to involve an interesting journey, I thought to document this as to provide a useful roadmap for myself and others...
What triggered the decision was coming across uklinux.net whilst browsing through messages within the freeserve.webspace.authoring Newsgroup. This ISP offers low-cost net access via 0845 telephone numbers with 20 MB of PHP-enabled web space & MySQL database facilities. It also offers domain-hosting on a paid-for basis (later update:- avoid them now at all cost).
Reading through the Status pages I was struck by the excellent attitude of the Site maintainers — perfectly open about problems, with the steps being taken to fix them and anticipated time scales involved. This was such a refreshing contrast with the Corporate mentalities and attitudes of many other ISPs (deny everything, say nothing & do the minimum necessary) that the decision mentioned above was born in me in that moment (later update:- the person responsible for that excellent attitude left the company shortly after I signed up).
I’ve gathered some good content into my current website across the last 2½ years. Having good content is one thing, being able to find it is another, and I’ve also taken a lot of time & trouble to make it easy to find the content. The trouble taken hasn’t been a problem, but the time is. Adding new content usually takes 3 times the amount of work that might be expected:
As the site grows this work becomes exponential. I’ve taken such steps as I can to minimize this (examples are use of Style sheets, IFrames & so on) but the only serious way forward is to recast the site with all content & references held within a central location — the database. The style of presentation is also held centrally within Style sheets, so the necessary extra is the glue that binds and weaves it all together (PHP).
What follows below is some info plus experience to date on the necessary steps involved in fleshing out the decision.
“Normal” HTML pages are mostly a client-side affair. An ISP Server provides the pages across the net, but after that point everything occurs within the browser upon the Client machine. With the exception of a little CGI Form-processing this is all that most ISPs allow.
A database-driven application is utterly different:
It should immediately be clear that there is an order of difference in difficulty between these 2 approaches. Standard HTML is dead easy — learn that a “<b>” & a “</b>” either side of a word will embolden it and you are away. Server-side work is something else: it needs database experience (and SQL in particular), object-oriented programming experience is useful for PHP and of course Apache normally runs on big-metal machines. Under Linux.
I’m lucky... database experience from the ’80s & SQL from the ’90s plus OOPing all over both decades in both a personal & commercial context. But apart from some design experience on Macs all my computer experience is with the very wonderful Windows, and 95/98 at that. Fortunately, I relish a challenge...
Even more fortunately, the best-on-Unix Apache turns out to be one of the best-designed Windows applications I’ve come across.
Other options for the job of web-server on Windows include PWS (Personal Web Server — provided free with win95/98), IIS (Internet Information Server) & others. Colleagues just arch one eyebrow when PWS is mentioned, IIS is designed for winNT/2000 whilst there is stacks of info & support forums for Apache, so Apache it is.
Info on the Windows version of Apache is available at “Using Apache With Microsoft Windows” whilst the download page links are here. These files were originally packaged as InstallShield executables but this caused problems for winMe/2000 users and they have been re-packaged as MSI (Microsoft Installer) packages. This does mean that win95/98 users (like me) or winNT users need also to download the MSI installer — links on the download page (I chose v1.20 & it all worked fine). All that I would add to Apache’s pages are that win95 users can download DUN v1.3 which also contains Winsock2 & thus fixes multiple problems in one download.
I started downloading both the apache_1.3.20-win32-no_src-r2.msi & the MSI package at the same time (MSI comes from the MS site via FTP). At about 68% on the Apache file and 24% on the MS file my wonderful Motorola SM56 ISA modem dropped the connection. Gritting my teeth I reconnected & recommenced downloading both files. Apache turned out to have a resume-enabled site and the download picked up where it left off. Microsoft’s file started at the beginning. It’s these little things that give you confidence in an organisation (or not).
I also won’t let the moment pass without making comment on the MS decision to break InstallShield. Microsoft really does come across as a woman that just cannot stand the idea of any other women sharing her house. This may be partly understandable until you consider that maybe this woman thinks that the entire universe is her house.
MSI is installed first, then Apache. Win95/98/Me needs to be connected to the net whilst Apache is installed (so that TCP/IP can be configured). I found this terrifying — win95/98 is too open to abuse — and left my Firewall up. Apache reported some Firewalls to cause problems with installation (it needs to be able to bind itself to port 80 during installation). I use ZoneAlarm and suffered no problems at all. ZoneAlarm detected Apache & asked if I should allow it to be a server. During installation I said yes; in later tests I said no and still found no problems.
It asked for host names/e-mail address during installation. As the server will not be used in my case to serve up pages to external computers I used the examples given. Much later I changed this value in the httpd.conf file to the local host address (below) but haven’t checked the effect of all this yet. For the same reason I’m also only using it as a “Console” application (no automatic startup when computer started).
Testing the installation is easy: launch Apache, open a browser & type in
http://127.0.0.0/ (no quotes). 127.0.0.0 is the IP address used universally to refer to the local host (the machine on which the words are being typed in my case). Press the enter key (up comes the DUN connection window — either connect or work offline) and... up comes the default Apache page. Wow! I felt fantastic. Then I thought, “Well, lad, you are finally confirmed as a sad nerd.”
(Oct: the only bug I’ve found concerns the GDI — attempting to play Solitaire whilst Apache is running leaves after-images of each card moved by the cursor on the screen.)
Postscript Feb 2016:
PHP 5.6.17 has a server option. eg
php --server localhost:8080 will serve up PHP (and HTML) pages from the console/command-line, using an address of
http://localhost:8080/index.php for a file ‘index.php’ resident in the folder from which PHP was started.
--------- Alex Kemp