What on earth is a development environment and why do I need it? It is fairly widely accepted that during the process of building your website, you should not make it available for people to use over the Internet. Making your site live, while you are still making changes and breaking and fixing things, means that it is possible for people to find your site, attempt to use it, and form an exceedingly bad opinion of your web development skills. You might, in the worst case, find that you have even inadvertently allowed malicious users to gain access to sensitive information due to improperly implemented security settings, among other things.
Rather than allow the public access to your work in progress, it is far better to set up a PHP‑enabled web server on your home or office PC. This server, along with PHP and your database, can then be used to design and build everything just as you want it, before transferring the final product over to the live site. A development environment is precisely that machine, along with its attendant development tools and technologies, where you can build your site. This chapter therefore will ensure that you set yours up correctly and efficiently so that you can begin working on Drupal directly in the chapters that follow.
Specifically, we will discuss the following important topics:
Installation and setup for Apache, MySQL, and PHP will only be covered for Windows because we trust that Linux hacks will have everything installed already (or will know how it is done). On the off chance that you don't have everything installed, a quick glance over the instructions given on the software-in-question's site should suffice to get you on your feet. The installation procedure for Drupal is much the same for Windows and Linux; so people using either can follow along with the Obtaining and Installing Drupal section.
Before we begin, however, there is one crucial bit of advice to be given:
For those users who have already installed various bits of software, you might find it convenient to skip whatever sections you do not need, going over only those that are of interest. As well as providing information on installation, this chapter will also have a troubleshooting section addressing some of the most common errors associated with the setup process for Drupal.
It should also be noted that because Drupal has been developed with flexibility in mind, it is possible to use it off IIS as an alternative web server, as well as utilizing PostgreSQL as an alternative database because support for these are actively being developed. Rather than show how to set each and every one up, we will focus on the most popular combination of Apache, MySQL, and PHP.
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, it will be of real benefit for you to 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 provide you with a working Drupal site, will help you immeasurably in the long run.
The best thing to do to begin with is take a look at each of the individual underlying technologies we will be using:
Now, since we don't want to waste too much time downloading and installing all the different pieces of software we need individually, we are going to use a package installation, which provides us with everything we need using only one installation. The package we will use for the purposes of this book is called Apache2Triad.
Now that we know what we are using, it is important to take a quick look at how we are going to be using it. The following diagram shows a simplified view of how everything works, with the shaded section denoting the Apache2Triad package containing the Apache web server, PHP interpreter, and MySQL database, with Drupal installed on the system:
So, whenever a user does anything with your Drupal site (hopefully like contributing meaningfully), here's what happens:
GET
or a POST
. For our purposes, it is not important to understand how GET
and POST
work, as long as you understand that information can be captured from the user and sent to the server for processing using these requests.There are quite a few methods of providing dynamic web content that don't rely on PHP server requests. Instead, processing is done on the client side of the application (in other words, on the web browser). We will take a look at how to enhance your web pages with JavaScript much later on, in Chapter 9, but what you have been shown here is fundamentally how everything works, even if there are exceptions to the rule.
While this section has been a bit of a whirlwind tour of the underlying technologies associated with Drupal, the information contained in here should prove to be invaluable at some stage. For example, knowing how everything fits together will often help you isolate the cause of any problems you encounter, allowing you to resolve them quicker.
Don't worry if this all seems a little daunting at the moment. Bear in mind that Drupal itself handles most, if not all, of the complexity associated with ensuring everything runs smoothly. As you will see, our job becomes one of customization rather than actual software development. With that behind us, let's get on with the installation process.
18.191.253.62