One thing you’ll discover when you start exploring
Blog and CMS (Content Management Systems) is that most
of them claim to be extremely easy to install. The reason
they make such a big deal of this is, one assumes, that
all the competing Blog/CMS packages are difficult to
install. Well, frankly, they can’t all be
right…!
In fact, in my experience, most of them are easy to
install if you know what you are
doing and hard to install
if you don’t.
Here is a real life example of the steps I had to go
through in order to install WordPress,
both remotely (onto my web host) and locally (onto my
hard disk). I decided to use WordPress as an example
for two reasons: 1) it is one of the most popular of
all Blog/CMSes and 2) it is so certain of the simplicity
of getting itself up and running that it proudly boasts
of its “world famous” 5 minute installation.
Just in case you didn’t get the message, it
goes on to say: “There have been reports of this actually
taking less than five minutes, but we're not responsible
for the installation being easier than it should be.”
OK, let’s put this to the test. Deep breath. here
goes…
NOTE: While the installation routine described
here focuses on WordPress, you will encounter some
of the same issues when installing other Blogs
and CMS software which use PHP and MySQL. |
The Famous Five Minute Installation
THE OFFICIAL VERSION
This is what it says on the WordPress
site...
1. Make sure your host meets the requirements. Also,
have a database ready with proper username and password.
2. Unzip the package you downloaded.
3. Open up wp-config-sample.php and fill in your database
details. Save and rename the file to wp-config.php.
4. Upload all the files to your webhost
5. Run the installation file. Relative to where you uploaded
the files, it'll be in wp-admin/install.php.
REMOTE INSTALLATION
This is how it went in practice
1. Make sure your host meets the
requirements…
Minimum requirements are PHP 4.1or greater and MySQL
3.23.23 or greater. I logged into my host’s control
panel and checked. It has PHP 4.3.10 and MySQL 4.0.25.
So far so good.
My host's control panel shows that it meets the requirements
Also, have a database ready with proper username and
password.
The WordPress installation glosses over this step. Fortunately,
I’ve had to do this kind of thing before so I realised
that I now have to create a MySQL database. To do this,
I find the MySQL icon in the control panel and double-click
it.
This is the MySQL icon in my control panel
This takes me to a page which shows details of existing
databases (if any). At the bottom of the page are fields
that let me add a database and add a user. I add a database
called ‘wordpress’ by entering this name
into the Add DB field and clicking the button.
A message
tells me that the database has been created. I click
a ‘Go Back’ link to go back to the page I
was working on. I see that a new database has indeed
been created; it is identified by my control panel user
name followed an underscore followed by the name of the
database. For example, if your control panel login name
is myusername and the name you chose
for the database was wordpress, the
complete database name will be:
myusername_wordpress
Currently
this database has no users. I now create one by entering a name (once again ‘wordpress’)
into the UserName field, followed by a password (which I carefully
remember or have tattooed onto an intimate part of my anatomy for later reference
- it happens to be the easily memorable ‘xysctatagf’). Then I click ‘Add User’.
A message tells me an account has been created and I
click the link to go back to the previous page. Now I
have to add the user to the database. I do this by selecting
the database and user names (which, due to the way I
named them earlier, happen to be identical - namely myusername_wordpress)
in two drop-down lists. Then I click the ‘Add
User to Db’ button:
Another ,message pops up to confirm that the selected
user has been added to the selected database. I click
Go Back again. Now I can see a listing showing
that the wordpress database exists and has been associated
with the specified user:
This is the CPanel page which displays details of the
installed MySQL databases and associated users.
OK, now I think I’m ready to continue with the
WordPress installation.
2. Unzip the package you downloaded.
Done this on my local hard disc.
3. Open up wp-config-sample.php and fill in your database
details. Save and rename the file to wp-config.php.
The wp-config-sample.php file is found
in the top-level Wordpress directory which I just unzipped.
I open this in Notepad and I find four lines of MySQL
settings at the top. I edit these to match the MySQL
details I just set up. Both the DB and User names are wordpress.
The password is the one I entered, ‘xysctatagf’, and
the host name is ‘localhost’ (it’s
usually localhost but, if in doubt, the Connection string
shown for the database in your CPanel page should show
you the actual name e.g. “DBI:mysql:myusername_wordpress:localhost” -
make a note of the name in the last part of this string).
This is how I edited my database settings in the wp-config-sample.php file:
define('DB_NAME', 'myusername_wordpress');
define('DB_USER', 'myusername_wordpress');
define('DB_PASSWORD', ‘xysctatagf’ );
define('DB_HOST', 'localhost');
I then saved this edited file back to the Wordpress
directory with the new name wp-config.php.
4. Upload all the files to your webhost
OK, you’ll need an FTP program for this. I’m
assuming that you already have one of these and know
how to use it. At any rate, most web design tools, such
as Dreamweaver, will have one built in. Upload everything
from the entire Wordpress directory and subdirectories
to a location of your choosing on the remote server:
Here I am FTPing the Wordpress directory from my hard
disk into a WordPress directory on my web host using
AceFTP.
5. Run the installation file. Relative to where you
uploaded the files, it'll be in wp-admin/install.php.
OK,
so assuming my web site is called www.bitwisemag.com and
I FTPed the files into a directory called /wordpress,
the address I need to enter into my browser would be
http://www.bitwisemag.com/wordpress/wp-admin/install.php.
Hurrah!” It works and this is the screen I see…
When prompted, I enter the username and password and
pretty soon I find myself in the WordPress administration
area. The famous five minute install was, to be fair,
pretty simple - but it assumes (perhaps unreasonably)
that you already know your way around your web host’s
control panel with particular emphasis on the steps needed
to create a MySQL database.
Now, let’s try a local installation…..
LOCAL INSTALLATION
These are the steps you need to follow to get WordPress
installed onto a PC running Windows.
1. Download the WordPress installation package and unzip
it to some directory of your choice.
2. Make sure you have previously installed the Apache
Server, PHP and MySQL (see our guide
to Windows, Apache, MySQL and PHP).
3. Use Notepad to open the wp-config-sample.php file
(in the directory to which you unzipped Wordpress). Fill
in your database details. This is done by locating these
MySQL entries at the top of the file…
define('DB_NAME', 'wordpress');
define('DB_USER', 'username');
define('DB_PASSWORD', 'password');
define('DB_HOST', 'localhost');
…and editing (if necessary) the second string
between each set of braces.
‘wordpress’ should be changed to the name you will use for the
MySQL Wordpress database
‘username’ should be changed to the user name you used when you
installed MySQL
‘password’ should be changed to your MySQL password
‘localhost’ should be changed (if necessary) to the host name you
used when you installed Apache
In my case, I will call the MySQL database ‘wordpress’ so
I will leave the first string as it is; I will use my
MySQL user name ‘admin’ and my MySQL password ‘topsecret’.
My local host name is ‘localhost’ so that
remains unchanged. This is the result after editing:
define('DB_NAME', 'wordpress');
define('DB_USER', 'admin');
define('DB_PASSWORD', 'topsecret');
define('DB_HOST', 'localhost');
The edited file now needs to be saved back into the
same directory from which it was loaded but with the
new file name ‘wp-config.php’.
4. Upload all the files to your webhost.
My ‘local
host’ is the \htdocs directory
beneath my installation of the Apache Server. So to ‘upload’ the
files I copy the entire \wordpress directory
(the one I just unzipped) and all its subdirectories
beneath \htdocs
5. Run the installation file. Relative to where
you uploaded the files, it'll be in wp-admin/install.php.
As I’ve installed Apache Onto my G:\ drive, the
full path to this file on my PC happens to be G:\Apache
Group\Apache2\htdocs\wordpress\wp-admin\install.php.
But since \htdocs equates to \localhost\ when I use a
web browser, I can run install.php by entering this address
into my browser:
http://localhost/wordpress/wp-admin/install.php
NOTE: At this point, you may get a message:
Your PHP installation appears to be missing the MySQL
which is required for WordPress.
If so, refer to our MySQL
installation info. |
You must create a MySQL database with the name specified
in wp-config.php. That’s done by running the MySQL
Command Line client (from Windows Start menu), entering
your MySQL password when prompted then, at the mysql
prompt, enter the command CREATE
DATABASE <dbname>; (where <dbname> is the database name). Here's
an actual example:
CREATE DATABASE wordpress;
MySQL should reply something like ‘Query ok, 1
row affected’. Then you are ready to go. Just enter ‘quit’ at
the prompt to shut down the MySQL command line.
This is the MySQL command line client, displaying the mysql
prompt and awaiting your command
Here I've entered one command, create
database wordpress; (remember
the semi-colon at the end!). Then, to verify the databases
available, I've entered show databases;
NOTE: To delete an existing database enter the
command DROP DATABASE <dbname>; For example:
DROP
DATABASE wordpress;
Naturally, use this command
with extreme caution! |
OK, it took me a few hours to get this far but at last
I am on step 5 of famous 5-minute install…
WordPress welcomes me and I click the
First Step >> link…
I enter a title for the weblog and an email address,
then click the big button…
Something chugs away on the disk for
a few seconds then, viola! WordPress tells me it’s
all finished. It gives me my user name, a randomly generated
password and a login address which I duly click…
And here I am, all ready to log in.
In truth, once I’d got everything set up, the
WordPress installation was a breeze. It took considerably
less than five minutes. But getting my PC set up with
the Apache server and (particularly) PHP 5 and MySQL,
took hours of work beforehand…
PROBLEM...!
Ugh! ....except
that when I try to log in, all I see is an index of the
files in the wp-admin directory…
Time to search the Web for help. Which I eventually
found on the WordPress support forum. It turns out that
Apache needs to be told that index.php is
a valid file to use as a ‘home’ page. To
do this, I had to load up the Apache httpd.conf file.
You can load the httpd.conf file from the Apache group
on the Windows programs menu
In this file I searched for index.html.
I found it in this line:
DirectoryIndex index.html index.html.var
I added index.php to the end of this, like so:
DirectoryIndex index.html index.html.var index.php
Then I saved the file and restarted Apache.
Restart Apache using the green arrowhead icon in the toolbar
Now, I refreshed my web browser (which is pointing to
the address http://localhost/wordpress/wp-admin/)
and to my joy, the file listing disappeared and this
nice friendly-looking admin panel replaced it…
Hurrah!
Huw Collingbourne
October 2005 |