Book Image

Drupal 6 Performance Tips

By : T J Holowaychuk, Trevor James
Book Image

Drupal 6 Performance Tips

By: T J Holowaychuk, Trevor James

Overview of this book

<p>Drupal is one of the most respected and widely used open source content management frameworks.&nbsp; Small, medium, and large-scale websites are built using Drupal and the framework supports ecommerce, CRM, multisite and web service integrations.&nbsp; <br /><br />Once you get your Drupal site installed and up and running, you will be concerned with site performance and how fast you can make your Drupal site run.&nbsp; This book will focus on implementing performance modules and solutions to help speed up your Drupal website.<br /><br />We will look at introductory topics such as upgrading your Drupal site, maintaining your site, and enabling core Drupal page compression and caching. <br />&nbsp;<br />Then we will turn to an advanced look at some contributed modules that help speed up performance, including Development, Boost, Authcache, Advanced Cache, and the Memcache API and Integration module.<br /><br />Finally, we&rsquo;ll look at how best to implement a Drupal multisite environment and run it with high-speed performance in mind.<br /><br />This book is designed for Drupal developers and webmasters who want to increase their Drupal site&rsquo;s speed and performance.&nbsp; You will take your Drupal site to the next level by not only displaying relevant and newsworthy content, but also running a powerful and high-speed website.</p>
Table of Contents (14 chapters)
Drupal 6 Performance Tips
Credits
About the Authors
About the Reviewers
Preface

Upgrading Drupal 5.x core


Before we perform a major upgrade from Drupal 5.x to Drupal 6.x, we need to make sure our Drupal 5.x core and contributed modules are upgraded to the latest 5.x releases. For Drupal core, this is currently Drupal 5.19. We can determine the latest release by visiting http://drupal.org/ and downloading the tar.gz for this release. There are also release notes about each version located at http://drupal.org/. For example, the Drupal 5.x release notes are located on: http://drupal.org/drupal-5.0. You can read more release notes specific to a version number in the CHANGELOG.txt text file and the UPGRADE.txt files located in the Drupal root folder of that version.

Here is our 5.x upgrade plan:

We're going to upgrade a site running Drupal 5.18 in preparation for a full version upgrade to Drupal 6.x. The first thing we're going to do is to upgrade this site to Drupal 5.19. We're also going to upgrade all of our contributed modules to the latest 5.x versions of those modules. This is important to do before an upgrade to 6.x—if all of your modules and core code are the latest version of 5.x, it will make the upgrade process run more smoothly and leave less room for parse errors, white screens, and other upgrade issues.

Note

Drupal.org notes the importance of upgrading to the latest minor version of your current Drupal version before starting an upgrade to a next major version release. So, in our case we need to upgrade to the latest version of Drupal 5.x (at the time of this writing, it is Drupal 5.19) before running an upgrade to Drupal 6.13. See the Drupal.org upgrade tutorial and articles at: http://drupal.org/upgrade/.

It may seem as though this workflow takes more time, but in the end your upgrade process will run more smoothly and with fewer problems.

The site we're upgrading is running Drupal 5.18. The theme is a custom version of the Zen StarterKit theme. The contributed modules on this site include CCK, Devel, Imagecache, Imagefield, FCK, Panels, Webform, jQuery, Views 1, and Lightbox. One of the main sections of the site includes an image gallery using Views and the Lightbox module to display photos of fire trucks. The Panels module is used to create a home page for the site displaying one blog post and the Lightbox-powered photo gallery.

Backing up your site and database

Before beginning, run a full backup of both your Drupal directory and your Drupal database(s). If you run a backup, you can be confident that if an issue arises during the upgrade process causing possible corruption of your database, you can easily restore your site with your backup. The rule is to always run backups before performing any upgrades, even minor security patches.

If you are on a shared hosting server environment, you may have access to your site's directory and files through FTP/SFTP or a cPanel type of file manager utility (cPanel and Plesk being two of the common utilities). You can either use file transfer protocol (FTP) to download your directory to your local desktop or use a backup application that your host provides through your cPanel tool.

To backup your database, you can use a tool such as phpMyAdmin—this will allow you to connect to your MySQL database and export your full database to your local desktop (as a SQL file). Here are the steps to back up your site:

  1. 1. FTP/SFTP into your server and copy all of your Drupal files or directories to your local desktop.

Note

A good habit is to name your local folder with the date of the backup: For example, backup-09-08-15—then if something happens, you can easily locate the last backup you ran.

  1. 2. Access your phpMyAdmin tool in your web browser (if your host provides access) and run an export of your Drupal database. Save the export file as a SQL (.sql) file in the same backup directory as your Drupal files.

  2. 3. If you are running your Drupal site locally (via localhost) or you have remote access to the actual server, you can simply copy the entire Drupal site folder and paste the folder into a backup folder on your server desktop or computer desktop. Then you can zip the backup or archive and save it until you know you have successfully completed the upgrade process. Before copying the entire Drupal site folder, you may want to check to make sure you can see all the files in your site folder. Occasionally, the operating system will hide files, for example your .htaccess file, so it's a good idea to show these files before backing up to make sure you are also backing up your .htaccess and any other hidden file.

Now you have a full backup of your Drupal site files and your database. You're ready to proceed with upgrading your site to 5.19.

Taking your site offline

The next step is to take your site offline for maintenance. It's good practice to always take your Drupal site offline during the upgrade process to prevent any public site visitor from accessing your site and viewing error messages that may appear during the upgrade. Your authenticated users with administrative level permissions will still be able to login to the site while it's offline. Good practice states that you should advise your authenticated user base that you will be performing site maintenance, so they avoid logging in during the process.

First login to your site as user/1 (the super user admin) and then:

  1. 1. Click on the Administer link in your main navigation menu.

  2. 2. Click on the Site Maintenance link (in the Site configuration section of your admin screen).

  3. 3. Select the Off-line radio button.

  4. 4. Type in a Site offline message that your general public site visitors will see when they try launching your site while it's offline. You can add full HTML and images to this message.

  5. 5. Click on the Save configuration button.

Running Status report

You will be running the Status report often during the upgrade process to check on the status of your Drupal site. The Status report will tell you if you have any issues in your site that need to be resolved before trying an upgrade. To have upgrades run as smoothly as possible, it's good practice to run Status report and make sure the majority of your report is checked green telling you the site is operating smoothly. This will cut down on the amount of parse errors you get during the upgrade process as well as removing other upgrade problems. Let's go ahead and run it now to get a quick update on the site we'll be upgrading. The Status report tells us how our Drupal site is currently running and performing.

  1. 1. Go to your Drupal Logs' admin section and click on Status report (Administer | Logs | Status report )

  2. 2. Review the current status of your site. Notice that our site is running Drupal 5.18. This tells us immediately that we need to upgrade to Drupal 5.19 before doing a full upgrade to 6.x.

  3. 3. Notice that our PHP memory_limit is set too low for performance purposes. We're getting a flag with our imagecache settings due to the 32M limit we have set currently. Once we complete the upgrade process, we'll want to return to this issue and raise our memory_limit. This is something we will cover in Chapter 2.

  4. 4. Run cron manually to flush the Status report and re-index our site. This also will allow you to check to see if any other red flags show up.

Status report is important when you're maintaining a client site for the first time. You can login to the site as admin and quickly get an update on the site and check the exact Drupal version the site is running. It also gives you a link to your PHP settings, which is something we will cover in Chapter 2.