Tuesday, December 28, 2004

WAMP

There are other tutorials on how to set up Apache, PHP and MySQL on a Windows machine, but for what it's worth, this is how I do it. It's important to note that this is used on a testing server in a trusted environment. I have not gotten involved in any security issues here as it's not necessary in my particular case.

For the record, this applies to the following versions:

  • Windows XP Professional

  • Apache 1.3.31

  • PHP 4.3.10

  • MySQL 4.1.7


Let's get started!

Setting up Hosts

If you plan to use Apache's virtual hosts feature AND your testing server is on a different computer than the one you use, then you'll need to do some sorting out first. Virtual hosts allow you to run more than one website on a single web server. What this means is that you can have individual sites set up for each client, and be able to reference files in that site from the site root (or /) instead of just creating subdirectories for a single site as I have seen done elsewhere. For example, you can call http://client1 and pull up their test site, and http://project3 and see a completely different site, that can possibly be saved in a completely separate location on your hard drive.

For this to work, the computer running as your webserver should have a fixed IP address. And therefore each one of the computers in your intranet should also have fixed IPs. In Windows XP, click Start -> right-click My Network Places -> left-click Properties. (If you can't see it in your Start menu you can also get there via the Control Panel.) Then right-click the network connection that corresponds with your network card and left-click Properties. Scroll down the list if necessary until you can see TCP/IP. Double-click that and you'll see something like this:
Changing your TCP/IP settings

In this example, my workstation is called 192.168.0.5 and the computer that actually connects to the internet is 192.168.0.1. (Actually that's the address of my modem/router, but that's another story!) Assign a number along these lines to each machine in your intranet and adjust these settings accordingly. You will probably also need to obtain the DNS server addresses from your ISP and enter them into the lower section.

On a standard Windows installation you will find a file called hosts (with no extension - ie it's not called hosts.txt or anything like that) in C:\Windows\system32\drivers\etc. Open it in Notepad (or any other text editor) and below it add the hostnames you want to use next to the IP address you've allocated for your testing server. If the IP address of your testing server is 192.168.0.200, you might add:
192.168.0.200     client1 project3

You can keep adding hostnames, separating them with a space. When you fill the line, start a new one with the same IP address, a tab, and keep going with more names. I'm not sure how many names you can legally put on a line, but I found it stopped working for me if I had too many, so if that happens to you reduce the number on each line.

You will need to copy this file into the directory mentioned above on each computer in your intranet.

Now we can move on to setting up Apache!


Apache

  1. Download the instalation file from www.apache.org and run it.

  2. When prompted, use your computer's name (intranet in my example) as the server name

  3. Choose the desination directory. I prefer to keep all these things together, so I used C:\webserver\apache

  4. After the installation has finished, fire up your browser and enter your computer's name or ip address. You should see something like this:

  5. Apache confirmation page

  6. Now comes the fun - editing the httpd.conf file!


    • Line 342 - change AllowOverride to All (for htaccess files to work)

    • Line 385 - add extra filenames for the default document:
      DirectoryIndex index.html index.php index.php4

    • If you're using Virtual Hosts, uncomment Line 972 - NameVirtualHost *:80

    • Add details for your own virtual hosts as below:


    Adding virtual hosts

  7. Don't forget to restart Apache after making changes to httpd.conf, which you can do via Start -> Apache -> Control -> Restart



PHP

  1. Download the zip version of PHP from www.php.net and extract to C:\webserver, then change full php directory from php-4.3.10-Win32 to just php.

  2. There's a note in the install instructions: "Note: In PHP 4, you should move all files located in the dll and sapi folders to the main folder (e.g. C:\php)." - so do that. In this case, move them to c:\webserver\php

  3. To add the php directory to the system's path, right-click My Computer, choose the Advanced tab, and then click Environment Variables (near bottom of box). Find Path in system Variables, click Edit, and add ;c:\webserver\php to the end of what's already there. Don't forget the initial semi-colon. Click OK, then OK again. See below:

  4. Adjusting the path variable

  5. Rename php.ini-recommended to php.ini (it's in the main php directory)

  6. Now to edit the php.ini file:


  1. Line 397 deals with Magic Quotes. Check what your remote host has them set to and make this the same.

  2. Line 443 - change to extension_dir = "C:\webserver\php\extensions"

  3. Line 565 - uncomment the extension to load GD2

  4. Line 611 - add your ISP's SMTP server address

  5. Line 829 - Change to session.save_path = "C:\webserver\php\temp" and make sure you add a temp folder to your php folder


  • Go back to Apache's httpd.conf, and add this before the Virtual Hosts stuff at the bottom of the file:

  • LoadModule php4_module "c:/webserver/php/php4apache.dll"
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    # specify the directory where php.ini is
    SetEnv PHPRC c:/webserver/php
    # AddModule mod_php4.c

  • Create a PHP page with phpinfo() in it and make sure it works!



  • MySQL

    1. Download the 'essentials' version from www.mysql.com

    2. Choose custom install and change the installation directory as below:

    3. Changing installation directory in MySQL

    4. Choose Standard Config when prompted

    5. Install as a service

    6. Add root password (and don't forget what it is!)

    7. When done, create new file in the root of C called my.cnf, and add:

    8. [mysqld]
      basedir = C:webservermysql
      datadir = C:webservermysqldata

    9. If you haven't already, now is a good time to download phpMyAdmin and install that in a new folder with it's own hostname. Adjust the setting in its config file and fire it up. With a bit of luck you'll see two databases and you can start creating your own!

    Friday, December 24, 2004

    Politically correct seasons greetings

    In this age of the global village and the associated political correctness, you need to be careful what you say to people at this time of year.

    So it is timely I stumbled upon this:
    Please accept with no obligation, implied or implicit, this wish for an environmentally conscious, socially responsible, low stress, non-addictive, gender neutral, celebration of the coming holiday, practiced within the most enjoyable traditions of the religious persuasion of your choice, or secular practices of your choice, with respect for the religious/secular persuasions and/or traditions of others, or their choice not to practice religious or secular traditions at all; and a fiscally successful, personally fulfilling, and medically uncomplicated recognition of the onset of the generally accepted calendar year 2005, but not without due respect for the calendars of choice of other cultures, and without regard to the race, creed, colour, age, physical ability, religious faith, choice of computer platform, political inclinations, favourite sports team or sexual preference of the wishees. By accepting this greeting, you are accepting these terms. This greeting is subject to clarification or withdrawal. It is freely transferable with no alteration to the original greeting. It implies no promise by the wisher to actually implement any of the wishes for himself or others, and is void where prohibited by law, and is revocable at the sole discretion of the wisher. This wish is warranted to perform as expected within the usual application of good tidings for a period of one year, or until the issuance of a subsequent holiday greeting, whichever comes first, and warranty is limited to replacement of this wish or issuance of a new wish at the sole discretion of the wisher.

    Courtesy of Steve Davis

    Thursday, December 23, 2004

    What are Aussies searching for?

    Google have released their Australian top searches for 2004. The news everyone was waiting for? Shannon Noll was searched for more than Guy Sebastian! (Yep... we all needed to know that!) Also worth a look are the global results.

    Worth noting:

    • Janet Jackson was more popular than John Kerry (Maybe that explains the result of the US election)

    • Searches for cricket made number 8 in the sports list

    • The top 4 global searches were all females (Britney, Paris, Christina Aguilera and Pamela Anderson)


    Enough useless trivia? Yep!

    Sundry Links

    Maps
    Drawing navigation maps using Illustrator (but this really applies to any vector-based drawing program.)
    CSS Troubleshooting
    Dave Shea's CSS Crib Sheet should get you out of trouble. Maybe!
    Favourite Javascripts
    A collection of Javascript snippets. Some useful, some not so. Also links to a multi-level suckerfish-style flyout. (What a mouthful!)
    Woody
    A free program for creating seamless wood-lloking textures and tiles.
    Zebra Tables
    Creating tables with different colour or style on alternating rows.
    CSS Sprites
    Using a single image for CSS hover effects instead of using the old javascript preloaders.
    PHP image/text replacement
    Using PHP's GD image library to dynamically replace text with an image on the fly.
    Flash image replacement
    Using Flash for your page titles. I must get around to trying this out one day...

    Tuesday, December 21, 2004

    Cross Column Pullouts

    The latest issue of A List Apart deals with having pullouts span multiple columns.

    For the uninitiated, a pullout is the name for the box above that says "Can this box span multiple comuns?". Floating it within a single column of text is pretty simple. Spanning more than one column is a bit trickier.

    It looks great on a printed page, but I'm not sure why you'd want to create a multi-column content layout for screen output anyway. Why force your readers to scroll up and down the page more than once? I think the practical applications of this one are fairly limited. Although, having said that - I'm sure it could form the basis for something more practical.

    Waterfall Web is Born!

    I know there are archives here and such - but today I finally got around to putting this site up!


    The archived posts prior to this one are actually copied over from my old Blogspot blog. I'll abandon that one now and put everything here instead.


    What will this blog cover? Will anyone ever read it? Does anyone actually care?


    Stay tuned...

    Website Project Management Part 1 : Introduction

    It's probably fair to say that most website projects are not managed, they just happen. Do up some designs, slice the graphics and code it up, drop some content in and viola! We have a website!

    This might be okay if you're working on one or two at a time, but when you get to half a dozen or more, you'll quickly find you need some project management skills.

    I'll be outlining here over the next few posts a method that works for me. I'm always fine tuning it, so it's by no means perfect, but if you currently have no management system in place at all this will hopefully set you heading in the right direction.

    I'll be referring to phpCollab (as that's what we use), so it might be a good time to download, install and configure it before we go much further. There's setup instructions on their website, so I won't repeat them here.

    There's your homework for now, next time we'll deal with basic project management principles.

    Monday, December 13, 2004

    Embrace the Web for what it is

    The article A Dao of Web Design is a bit old now, but it's well worth another look. I had a client today looking for pixel-perfect placement across multiple browsers & screen resolutions. That's not what the web is about. Hours can be wasted getting line endings to be in exactly the right spot - and then on someone else's computer it will probably be different anyway!

    Embrace the control that the web puts in the hand of the user & you'll sleep much better at night!

    Sunday, December 5, 2004

    Browser Wars - Reloaded

    If you're reading this then you're probably aware that Microsoft's stranglehold on the browser market is slipping. A survey from late November tells a dramatic story. Since May, it's total market share has fallen by 5%. That's pretty substantial in 6 months, especially considering that the fall has been taken up by Mozilla's Firefox, which people have to choose to download and install. It's not part of anyone's operating system.

    It reinforces the need for testing of your website in multiple browsers and operating systems before it goes live. Whilst it was always a fallacy to only worry about one browser, now it's becoming statistically significant again.

    There are a few issues with testing, though. The first one is installing multiple versions of Internet Explorer on the same version of Windows. Joe Maddalone managed to figure out how it's all done, and to simplify the setup process I've packaged up version 3, 4, 5 and 5.5 into a single, simple installation file.

    After that installing Firefox, Netscape, Opera and whatnot are easy. Of course, that doesn't solve problems with IE5 for Mac or Safari if you're a PC-only office (like here)! So maybe it's worth signing up with Browsercam and being done with it! ;)

    Friday, November 19, 2004

    Thou shalt not link to thyself

    The concept of pages not linking to themselves is not new - but if you're using Dreamweaver-style templates there's a bit of extra work to make that happen.


    The Man in Blue posted an article about using CSS to make it appear that the page was not linking to itself, which received a mixed response. Inventive, but not really a complete solution. One of his readers then posted a javascript solution which loops through the page and removes any self-links automatically.


    Clever thinking!


    And that got me thinking... (Dangerous, I know)

    Thursday, November 18, 2004

    CSS Filters - Browser Matrix

    Fantastic layout - looks great in your browser - and then you cross test it... :(


    Browsers behaving differently?


    Of course they do! (Would we have it any other way?) But here is a matrix of what filters (or hacks, if you prefer) work in different browsers.


    I guess hacks are a last resort, but sometimes you just can't avoid them.

    Wednesday, November 10, 2004

    Websites are like Pinball Machines

    “How do you figure that out?” you might ask.

    An interesting commentary was published on Evolt.org yesterday, in which the author makes the following observations:

    1. Pinball machines have to stand out in the arcade, and quickly communicate a message to passers by (usually something like “I’m fun!"). The home page of your website needs to quickly communicate too, so people don’t just “wander by”.

    2. Pinball machines have the same basic controls, and while the machines themselves differ in what they do, you don’t need a licence to operate them. Similarly, a website needs to be easy to use with simple controls (or buttons).

    3. Pinball machines offer feedback when targets are reached, and encourage new players to keep going. Websites need to do much the same thing, and offer the right amount of information at the appropriate stages.

    4. Pinball machines have a built-in processor that tracks usage, how many free balls are awarded, and so on. Websites can offer you a lot of information about it’s usage - the point is, do you monitor it? You can’t improve what you don’t measure!

    5. Is your website memorable? Classic pinball machines have something memorable about them - what will people remember about your website?


    And in closing, the author states:
    “The reason pinball machines are a good metaphor for conducting business online is because they are business tools. Their purpose is to make money. And, they do so by giving users a pleasant experience in hopes of establishing loyalty and return visits.

    Interesting illustration. Read the full article here.

    Backup!

    Hard drives have moving parts. Little motors that spin disks around at 7,200 revolutions per minute. Like anything with moving parts, hard drives eventually wear out.

    If yours wore out today - how much information would you lose? Family photos? Accounting data? More?

    Backing up is a bit of a nuisance to have to do, but if you have anything vaguely important stored on your computer it’s a necessary chore. With the price and availability of CD or DVD burners, it’s not quite the task it used to be, either. A couple of options:

    One: Burn it to CD or DVD

    Quick tip: use re-writable media for your important backups. Either CD-RW or DVD-RW/DVD+RW. The reason? Regular CDs and DVDs have big questions over their longevity. Maybe they’ll last for decades, maybe they won’t. It’s pretty much agreed though that the re-writable versions last much longer, as they use a different method of actually storing the data. I won’t get all technical here, but to be on the safe side, use rewritables for your backups or archives.

    Two: Use an external hard drive

    An alternative is to use an external hard drive. These plug into a USB port so they’re nice and easy to use. Create a folder with the date, and copy your ’stuff’ over. Next time, create a new folder with the new date, and so on. When the external drive gets full, delete the oldest folder and keep going.

    What to backup?

    This will vary from person to person & computer to computer. But you’re basically looking for:


    1. Your “My Documents” folder.

    2. If you’re using Outlook, search for your *.pst file. That has all your email, your calendar etc.

    3. If you’re using Outlook Express, search for the *.dbx files and include the whole folder that they’re in. Then find your *.wab file, which is your address book.

    4. Accounting programs like MYOB or Quickbooks often save files in their own folders - make note of where they are too.

    5. Check any other industry-specific software you might be running, and see where they save their data files.



    This list is by no means complete - get some specific advice if you’re unsure.

    But whatever you do - put some sort of backup strategy in place before it’s too late!

    Tuesday, November 2, 2004

    Searching in other languages

    Google is available in many languages - you may or may not have noticed the “Language Tools” link just to the right of the search box. But some of the languages are, well, interesting!

    There was obviously going to be a version in Klingon. Did you know you can search using pig latin? Or hacker? (Look at it closely, you can kind of read it.) Or how about Bork Bork Bork, which I’m assuming refers to a certain Swedish Chef from the Muppet Show. But my favourite is Elmer Fudd. I never realised it was a language. Or maybe I should say I never weawised it was a wanguage!

    Sigh… Some people have too much spare time…

    Wednesday, October 27, 2004

    Standard or Best Practice?

    The Web Standards Project asks What is a Web Standard?

    It's a good question - as many of the things we refer to as 'standards' turn out to not be standards at all - but they are best practice. I suppose it might be splitting hairs, but to be technically correct we shouldn't be calling things standards that aren't. Things like semantic markup and separation of presentation & structure, for example.

    However, as the author states:
    What we absolutely must do is take care to spread a message that encourages rather than discourages using the best science and best practice. It is holding that goal high that makes us professionals, after all.

    Friday, October 22, 2004

    SEO v SEM

    I never really thought about it before, but Search Engine Optimisation (SEO) and Search Engine Marketing (SEM) are not quite the same thing. SEO is something you do as part of an overall SEM strategy.

    The latest Market Position newsletter outlines 5 steps for successful SEM, and looks at things from a strategic perspective rather than a technical one. All simple stuff, but it's good to be reminded of the simple things from time to time.

    Saturday, October 16, 2004

    Noise Over Free Trade Agreements

    Firstly, let me say I don't normally comment on things political. My typical response is "whatever!"

    However, John Allsopp has written a piece on the impact our recent Free Trade Agreement with the US has on our IP laws. Or, if he's right, they're not our laws anymore.

    What he's basically saying is that we're handing over our right to make our own laws regarding copyright, patents and trademarks over to the US. We adopt US law in these areas.

    If he is right - it's a bit concerning that we would hand over a sovereign right to make our own laws to be at the mercy of US corporations who influence congress.

    I can't think of anything about the US legal system that I'd like to see reproduced here, much less having them make our own laws for us!

    Not happy, Jan!

    Sunday, October 10, 2004

    The Four Essentials of Modern Web Design

    The Web is a young medium: it's really only about 10 years old. Consider television at age 10, or cinema. Back then, these media were primitive, still finding their way. They were exploring the limits of new technology, but huge developments were yet to be made.

    Web professionals are at that same point today. We're pioneers, still exploring the limits of a new medium. Our grandchildren will, no doubt, look back on what we're doing and think it's quaint. We still have much to discover about what the Web can do, and how it can be used.

    Enter: conferences such as Web Essentials 04.

    Web Essentials 04 was a two-day conference held in Sydney, Australia, from 30 September to 1 October 2004, which explored in detail the essential pillars of the Web. Speakers included Dave Shea, Douglas Bowman and Russ Weakley, just to name a few.

    The four essential practices on which the conference focused were:

    1. Valid code (standards compliance)

    2. Accessible code

    3. Semantically correct code

    4. Separation of content and presentation