Installation Wiki

Setting Up The Development Environment for Drupal 6

From InstallationWiki

(Redirected from Drupal 6)
Jump to: navigation, search
Drupal 6
Official Page
Project Documentation
Download
Source Book
Building Powerful and Robust Websites with Drupal 6
Building Powerful and Robust Websites with Drupal 6
ISBN 978-1-847192-97-4
Publisher Packt Publishing
Author(s) David Mercer

Contents

[edit] The Drupal Environment

I know most of you will be eager to get going at the moment, and might well prefer to dive straight into making modifications to your Drupal site. Before we do so, we can take a few moments to read over this section to gain an appreciation of how everything is put together behind the scenes.

Having a basic knowledge of how the various technologies co-operate in order to produce a working Drupal site will help immeasurably in the long run.

Take a look at each of the individual underlying technologies we will be using:

  • PHP: PHP, or PHP Hypertext Preprocessor, is the language in which Drupal is written. PHP is widely used on the Internet for a multitude of different projects and is renowned for its ease of use. The current version of PHP is PHP5.It is strongly recommended that you use PHP5 from now on because support for PHP4 will soon be discontinued and Drupal 7 will no longer run on anything less than PHP5! .The good news is that we will not have to delve deeply into programming code in order to build a site Drupal handles most, if not all, of the complex programming issues.
  • Apache: This is the web server we will use to serve web pages during the development phase. Apache is the most popular web server on the Internet, with millions of live sites using it every day. In fact, as the Apache website says: It is more widely used than all the other web servers combined.
  • MySQL: This is the database software that we will use to store all the information required to keep the website running. Everything from customer details to product information and a host of other things will be stored in the MySQL database.You must make use of MySQL 4.1 or a later version in order to work with Drupal 6.


[edit] Obtaining and Installing PHP, Apache, and MySQL

We are going to make use of a package installation in order to simplify the task of creating a workable development environment. You will notice that most software installation is really about learning a single process and repeating it for whatever software you need. More often than not, you will:

1. Go to the software producer's site.

2. Find the download page and download the appropriate package.

3. Unpack the software or run the executable file, depending on the method of installation.

4. Install and configure the software most often you will be guided through the process in one way or another.

5. Test your setup.

That sounds easy enough; so head on over to http://apache2triad.net/, which is the homepage for the Apache2Triad project, and click the Downloads link in the left-hand box towards the bottom of the screen. (Feel free to browse around to learn more about this useful enterprise.) This will take you to the downloads page on the SourceForge site at: http://sourceforge.net/project/showfiles.php?group_id=93507.

Select the desired package for the purposes of this tutorial, release package 1.5.4 was used because it incorporates PHP5. You should feel free to use a later version, if there is one, as this will not affect the installation procedure.

Once Download is clicked for a package you will be presented with a list of download options. Release package 1.5.4 has only one option, as shown in the following screenshot:

This is the package we will download and install. Click the package name .exe file, and select a mirror site from which to download. Depending on your PC's security settings, you may be given the following message:

Click Save File to continue. At this point, you may take a break for a cup of coffee or tea if you have a slow connection as it may take a while the download is in excess of 95 Meg.

[ Note : Apache2Triad comes with a number of useful applications in addition to the core technologies needed for Drupal However, if this download is too large, then consider downloading XAMPP instead. XAMPP has lighter distributions of about 35 Meg available and will allow you to make use of Drupal easily. ]

At some stage during the setup process, the installer will ask you to confirm several settings and you are free to make changes as and when prompted. Take note that you will be asked to enter a password. Please ensure that you use something that is memorable and secure. Use eight characters or more and preferably some numerical digits.

Once everything has been done, you should receive a success message and the option to reboot. Save and close whatever important documents are open before clicking OK. Once the machine has restarted, you should have a whole list of new and exciting options to explore from the Apache2Triad option under All Programs in the Start menu. For example, the following options are made available with the 1.5.4 distribution:

There is quite a lot more than what we really need for our immediate purposes, but just to ensure that everything is going according to plan, click open site root in the Apache2Triad menu to open the following web page:

This confirms that everything is up and running as expected. Pretty easy so far! One thing to make note of in the previous screenshot is the final link called htdocs. Traditionally in Apache servers, htdocs is known as the root folder, and all the web pages that are to be made available must be placed inside htdocs. If something is not in htdocs, then it is not possible to browse it.

From this we know that we will have to locate the actual folder called htdocs on the file system in order to know where to put Drupal once it is downloaded. Assuming that you have gone with the default setup, you will find htdocs in the following directory (on Windows machines) along with everything else that was installed and created during setup: C:\apache2triad\.

It is worthwhile taking a look at what has been provided as part of the Apache2Triad installation because some of the facilities made available to you could well be most useful as time goes by. You will also find that many hosting packages on live sites offer pretty much the same functionality.

Of particular interest and use to us Drupal people is phpMyAdmin, which is a complete database management tool for MySQL. It can make life a lot easier whenever it is necessary to deal with data directly.

[ Note - If you are struggling to log onto phpMyAdmin or any other part of the site, then try using root as the username and whatever password you set during the setup process. ]

At this point, we now have a platform from which to begin building the Drupal site. Of course, we still need Drupal.

[edit] Obtaining and Installing Drupal

Head on over to http://drupal.org/download and click the Drupal version number you wish to download generally, the latest stable release is suitable. Click Download to grab the latest copy and save it to your C: drive, or your My Documents folder (or wherever you want).

[ Note : Drupal bugfix versions are represented by an additional digit after the main release version (i.e. 6.1, 6.2, and so on). Bugfix versions should be used over the initial release for obvious reasons! ]

Now, the Drupal download is different from the Apache2Triad installer in that we will install Drupal ourselves; it doesn't come with its own installer .exe file. Instead we are asked if we would like to Save (or Open) a .tar.gz file. In the event that your PC doesn't recognize .gz files (this is for Windows users), then download a zip program like 7-zip (http://www.7-zip.org).

Once you are able, open and decompress the downloaded tar.gz file, then extract it to the htdocs folder of your Apache2Triad installation. To make life easier, perhaps rename the extracted folder to something more memorable and shorter than its default name, for example, I have simply called mine drupal, as shown in the following screenshot.

With that done, open up a browser and navigate to http://localhost/drupal. Remember to exchange the bolded section for the actual name of your folder in the htdocs directory. You should be presented with the first page of the installation dialog, which looks like the following screenshot:

For the purposes of this tutorial we will deal with English. Go ahead and click Install Drupal in English in order to begin the process. The first batch of settings you are required to specify relate to the database that Drupal will use to power the site. Initially, the database does not yet exist, so let's create it quickly before continuing.

Open up a new browser and navigate to http://localhost/phpmyadmin and enter the name of the database you would like to use for the site. Give the database either the same name as your site, or, if that is not a suitable choice for one reason or another (perhaps your name has special characters or is too long), give it a sensible nickname, as shown in the following screenshot:

In this instance you can see that I have specified a database name of mf4good, which is an abbreviation of the full name of the demo site. Clicking Create brings up the following page and confirms that the new database now exists (although it still possesses 0 tables, as shown in the left hand frame).

We can now continue with the Drupal installation. The database settings page looks something like the following screenshot:

Notice that I have referenced the database just created, specified the user as root, and provided the password I supplied upon setup of Apache2Triad (since this is the only user that currently exists in our pristine environment).

Generally speaking, and for a number of reasons, it is not a good practice to use the superuser to access your database. The superuser (most often called root) is the one created by Apache2Triad upon setup to allow complete control over the entire environment, and this superuser has permissions far in excess of what we actually require in order to use Drupal. However, in this case, we can be slightly lazy and not bother to create other database users for now.

Since we are using our own personal machine for testing and development, we can ignore the Advanced options link at the bottom of this page because the default settings are appropriate as-is. If you are using a database server that does not reside on your own machine, then these settings can be used to specify the host, port and table prefix as required.

[ Note - A table prefix is prepended to the front of each table name in the database to prevent one installation from overwriting the tables of another. This can happen if, for example, another package using the same database has table names in common with Drupal's. ]

The following page allows us to specify some general administrative and configuration parameters. The first part deals with the site name and email address:

To begin with, you most likely won't have email setup on your current domain but this is not really a problem because you can enter any valid email to which you have access here. This will become important when the live site begins emailing people though.

The settings, as shown in the following screenshot, are very important because they control the administrator's (User 1) login information:

Ensure that you can remember whatever information is provided here because these settings specify the administrator's details. Forgetting them could mean a real struggle to get back into the site (it's not impossible provided you have root access to the database and can access all the information directly from PHPMyAdmin). The email address used here should be one that is convenient and active, and does not necessarily have to be a part of your new site's domain anything will do.

[ Note - The administrator account (User 1) is all powerful and has complete control over Drupal! Never use this account for everyday use of the site. Instead, create new users with specific access permissions to perform day-to-day tasks. ]

Quickly decide on a couple of server settings, and one in particular is quite important, as shown in the following figure:

Clean URLs make your site easier to index for search engines, and have a whole host of benefits and knock on effects. Assuming you are using the latest version of Apache2Triad, this option should be available. If it isn't, then don't panic because it may be available on the live site. At this point, it may be prudent to try and install a copy of Drupal onto the live site to check this out because if it is not available, then there are steps you can take to rectify the problem. More information on this can be found in Appendix A, in the section entitled Configure the Site.

Finally you can select the option, to automatically update your Drupal distribution using Drupal's powerful new update module:

With that, hopefully you are presented with a clean bill of health, as shown in the following screenshot:

[edit] Drupal's Post-Installation Status

It's worth noting before we continue further that it is often beneficial to have several development sites in order to play around with different things without mucking up other work. The process outlined so far in this tutorial can be repeated as many times as you like to set up as many development sites as you like simply create a new database (or, alternatively, provide any new Drupal installation with a table prefix in the Advanced options section) and add the Drupal files to the htdocs directory (ensuring they have a unique name) before browsing the new folder and repeating the installation process.

Whatever you decide, the next step is to click on the your new site link to bring up the default administration page (refer to the following figure):

Quite conveniently, we have everything we need to do laid out in four simple steps and this is more or less the route we will follow in order to get everything up and running too.

Bear in mind that this page will be replaced once you start adding content and modifying the site; it is only a temporary placeholder. The first port of call is the administration section, so click there. At this point it is quite likely that there will be another one of those red error messages urging you to check the status report. If that is the case, then go ahead and do so you will no doubt be presented with something that looks similar to the following screenshot (hopefully with less red involved):

This page displays information about the fundamentals of the Drupal installation. Anything showing in red or yellow needs attention. At the moment, the Cron maintenance tasks seems to be in trouble, but with a close inspection of the reasons for the error, you will see that the problem is not that difficult to solve the cron has not been run.

[ Note : Cron tasks are automated chores that Drupal needs to perform regularly in order to make sure that everything continues to run smoothly. ]

To deal with the cron error, click on the run cron manually link. This executes the cron script and we are one down with one to go.

Next, click on the file system settings page link. This will bring up the following dialog that allows you to specify where and how files should be uploaded to and from during the course of the site's normal operation:

Unless you specifically know whether or not the site will require public or private downloads, don't worry about any of these settings for now. Choose the Public download method and click on the Save configuration button before going back to the server status report (click on Reports and then Status Report in the main menu) to confirm that the installation now has a clean bill of health.

If you have an older version of Drupal, you can upgrade through very simple steps.

[edit] Summary

This tutorial covered the installation of PHP, MySQL, and Apache in a package called Apache2Triad although XAMPP is also recommended. As a result, the foundation from which to build a live site in the coming days and weeks has been laid. Setting up a suitable working development environment helps you avoid any needless wastage of time.

With the facilities provided by Apache, PHP, and MySQL installed on a test machine, we turned our attention to obtaining and installing Drupal itself, which is quite easy with the much improved installation features of Drupal 6!

If you have gotten this far, then congratulations, you are ready to begin developing a new site!

[edit] Additional References

  • For instructions on customizing Drupal 6 themes, click here
  • For instructions on Troubleshooting setup process of Drupal, click here

[edit] Source

The source of this content is Chapter 2: Setting Up the Development Environment of Drupal 6 by David Mercer (Packt Publishing, 2008.)