Book Image

Drupal: Creating Blogs, Forums, Portals, and Community Websites

By : David Mercer
Book Image

Drupal: Creating Blogs, Forums, Portals, and Community Websites

By: David Mercer

Overview of this book

<p>Drupal is one of the most popular content management systems on the internet. Based on PHP/MySQL, its power and flexibility combined with its exceptional design mean it is already on the way to becoming the de facto standard for CMS Websites. Drupal’s modular design and structured source code make it both highly flexible and easily extended and modified. Drupal is extremely scalable, making it ideal for both a simple personal website as well as an industrial strength commercial or institutional web presence.<br /> <br /> Drupal is a model open source project in that it has a large, friendly community of people who contribute to the project in various ways.&nbsp; Drupal is not only free and easy to use, but this community provides on going mutual support.<br /> <br /> Drupal’s power means choosing an initial pathway can be daunting. The flexibility and power of its content management features mean the right approach needs to be taken.&nbsp; This book takes you from initial set up through site design and creation in a series of carefully structured steps. While there are a few advanced topics that are beyond the scope of the book, all of the core stages of creating a website using Drupal are covered in detail.</p> <p>&nbsp;</p>
Table of Contents (16 chapters)
Drupal
Credits
About the Author
About the Reviewers
Preface

Setting Up the Site


At this stage, you should have a working database and be aware of what the username and password are for that database on your live site. You also have your archive file uploaded to the host site. At last, we finally move from working on the development machine to working on the live site. First thing's first though; we need to…

Set Up the Files

You will need to extract the archive file to your public_html folder—most likely your hosts will provide you with this functionality. Take note of the second option in the list shown here:

With these files extracted, you should now have a replica of the files from the development machine on your host's site. Check this by browsing through the live site. You should also find that if you attempt to browse one of the pages from a web browser, you no longer get a page‑not‑found error, but some other type of error—most likely a MySQL error because we don't have a database connection yet:

This is great news because it means that we are able to browse the files that are now on the live site with no problem. The fact that there is a Drupal error message here confirms that we are in fact browsing Drupal pages—note that the error message shown in the previous screenshot mentions a username and server that are not correct. This is here to demonstrate more clearly that we are browsing Drupal but we have not yet entered the correct database or configuration settings.

Set Up the Database

If you have access to phpMyAdmin on your host site, then open it up and follow along:

  1. 1. In the left-hand panel on the phpMyAdmin home page, click on the name of the database you installed earlier. (Recall that for the demo site, this was entitled contechj_contechst.)

  2. 2. In the new page that opens up, click on the SQL tab along the top of the page.

  3. 3. Click Browse under the Location of Textfile option.

  4. 4. Locate the file you would like to run against the database, and click Go.

If all goes according to plan, you will get a message informing you of the successful modifications to the database. You can then take a look through phpMyAdmin to ensure that the database has got whatever tables are needed.

It is possible that there may be issues between your host's system and the one you used to create the backup. For example, I initially received the following error:

This is because differing versions of MySQL sometimes use slightly differing syntax and it was necessary to remove all the DEFAULT CHARSET=utf8 statements from the .sql file before everything ran smoothly.

If you do not have access to phpMyAdmin, then you will simply need to install the database using the .sql file in whatever manner is appropriate for your particular site. Recall that you are able to run the .sql file from the command line if you have access to that—if not, it's time to get in touch with the support team and find out how they recommend you run the contents of your .sql file.

Configure the Site

With the database in place, go back to your settings.php file in the sites/default/ folder on your live site and alter it according to your system's setup—take care to ensure that you add precisely the names and passwords required by your live database to $db_url as well as the correct URL for the live site in $base_url if that is required.

Once you have set the configuration settings appropriately save the file and then try browsing some pages. With a bit of luck you will see everything more or less as it was on the development machine.

Access Problem?

Try to log in to the administrator's account. I suspect that more than a few of you will come across a somewhat nasty surprise in that the browser will no doubt tell you that it cannot find the page you are looking for. If this is the case, it is more than likely because the .htaccess file was not successfully ported to the live site:

Note

You must ensure that Drupal's .htaccess file is present on the live site! .htaccess in the Drupal parent folder contains instructions and information vital to the healthy operation of the site. Ensure that you transfer it directly, or cut and paste its contents into the live site's .htaccess file.

When viewing the contents of the .htaccess file on the live site (in Drupal's parent folder, most likely in the document root depending on how you have things set up), you should see something like this:

<IfModule mod_php5.c>
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
</IfModule>
# Reduce the time dynamically generated pages are cache-able.
<IfModule mod_expires.c>
ExpiresByType text/html A1
</IfModule>
# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
#RewriteBase /drupal
# Rewrite old-style URLs of the form ‘node.php?id=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^id=([^&]+)$
#RewriteRule node.php index.php?q=node/view/%1 [L] ...

If that is the case, then you should find that it is possible to browse the live site as normal. Take heart, we are nearly done! The only thing left on the list of things to do for the moment is…