Upgrading your custom theme

Now we need to add our custom theme back to the site. Our theme is called 'Apollo' and we originally used the Zen Themer's Starter Kit files in Drupal 5.x to create this custom theme. Here are the steps for upgrading our custom theme to Drupal 6.x and for using the new upgraded Zen Themer's Starter Kit code base. Bear in mind that we did not make any template code edits to our original Apollo theme, so we do not need to worry about updating our new template files with our existing template...

Upgrading contributed modules

We're now ready to update our contributed modules to their 6.x versions. Follow these steps 1. Download all of the contributed module tar.gz files corresponding to the latest 6.x stable releases to a folder on your desktop. You may want to create a folder called contrib._module_upgrades to put the new releases in. 2. Once you have downloaded all the tar.gz files, extract them into your contributed modules folder. This will create all of your module folders (one for each module). If you are...

Throttling blocks

To do this, go to the Blocks admin page here Administer Site building Blocks. You'll notice that there is a new checkbox selection for Throttle. You can choose which blocks to throttle by checking the Throttle checkbox next to each of your enabled blocks. We'll go ahead and throttle all of our blocks except for the User login, as we still want to allow users to login to the site during high traffic periods. The throttle functionality works the same here as it...

Throttling your modules

You can also throttle each of your core and contributed modules as long as they have a Throttle checkbox next to their line item on the modules admin page. Load your modules admin page and look for the Throttle checkboxes. This allows you to tell Drupal to throttle a specific module during high traffic periods on your site. This means that when your site reaches a high traffic threshold based on the auto throttling settings you determined above your site will temporarily disable the module in...

Backing up and exporting your Drupal x Views

Our site is currently using the last version of Views for Drupal 5.x views s.x-1.6 . The Views module is notoriously difficult to upgrade to the latest version of Views2 for Drupal 6.x. You will want to make sure you export all of your View code from the Drupal 5.x version, and keep it in backup notepad files in case you need this code to rebuild your Views in Views2 in the event you receive errors during the upgrade process. This is a good practice before...

Table of Contents

Backing up your site and database 10 Installing the Update Status module 16 Installing contributed module updates 19 Uninstalling and removing Update Status 20 Running cron and checking recent log entries 21 Dealing with contributed modules during upgrades 22 Backing up and exporting your Drupal 5.x Views 23 Final prep for upgrading to 6.13 27 Disabling all contributed modules 28 Enabling the Garland theme site-wide 29 Upgrading contributed modules 38 Updating your PHP memory limit 41...

Using the Boost module

We're going to turn our attention to the Boost module in this section. Boost is a contributed module that allows you to run incredibly advanced static page caching on your Drupal site. This caching mechanism will help to increase performance and scalability on your site, especially if it gets heavy traffic and anonymous page visits, and it is on a shared hosting environment. This is usually the first contributed performance-based module to turn to for help when you host your Drupal site on a...

Upgrading to

Let's go ahead and start the 5.19 upgrade. Here are the steps 1. Download and extract the 5.19 tar.gz from http drupal.org to your local desktop. This will create a folder titled drupal-5.19. 2. Connect to your server through FTP SFTP. Open up your local FTP window to show the Drupal 5.19 folder. Make sure your remote window shows your current Drupal site. 3. Select and move the following folders includes, misc, modules, profiles, scripts, themes . Also, move over all of the root level files...

Introduction to Drupal caching

Drupal gives you various methods of caching your site's data and content by using the Drupal core administrative interface. There are a variety of contributed modules that allow for more advanced caching we'll look at these in later chapters . Drupal allows you to cache data and content in order to speed up the performance of your site in terms of how quickly your pages and entire site loads for the end user. Caching as much data and content as possible, especially the content that you show to...

Testing your Boost configuration

Now we're going to test out our Boost configuration and make sure everything is working with our initial basic settings and the .htaccess configuration that we're running. Log out of your website in your current browser or open up another web browser so that you can browse around your site as an anonymous user. The main thing we want to check on is that our static HTML type files our Drupal pages or nodes are being cached and stored in the cache directory we have specified in the module...

Disabling unused modules and themes

Now that you have your Drupal 6.13 site up and running, it's a good idea to review the core and contributed modules you're using, and to disable those modules and themes that are not being actively used. Disabling the modules will let Drupal know that it does not need to load those module hooks when they are not being used on the site. Disabling the module will keep the module in your site for future use and will keep that module's data in your database, but it will not be loaded during page...

Generating test users categories and content

Another use of the Devel module besides all the great functionality we discussed in Chapter 3 is to generate test 'dummy' content, taxonomy categories, and users for your website. This functionality is part of the Devel module and to confirm that you can use this, go to your admin modules list and check to make sure the Devel generate module is enabled. To generate users, nodes, and taxonomy terms for your site go to the Generate items main page in your site admin. That will launch a page with...

Checking your Drupal configuration status

Now that you have successfully upgraded to Drupal 6.13, you can run your Status report to check on the status of your configuration file and other site components such as the PHP and MySQL versions GD library version, memory_limit, and whether or not your modules are updated. Status report will give you the most up-to-date checklist on the general performance of your site. When we run Status report we find out the following Our update.php file is protected. The permissions on this file are 644,...

Configuring multisite in a localhost environment

We are going to configure our Drupal multisite environment on our localhost development server, either on Windows or Linux. I'm going to walk through the steps of setting this up on Windows because there's an additional trick for Windows users to make sure they can get a Drupal multisite environment functioning easily in a Windows development environment. However, these instructions will also work on a Linux system or a MAMP system on Mac OS. We'll also briefly discuss how to best approach...

Boost admin and stats blocks

The Boost module provides you with three blocks that you can enable and use on the administrative side of the site. Go to Site building Blocks and look for the following blocks Boost AJAX core statistics Boost Pages cache configuration Enable all three of these blocks to show in the right sidebar of your site. You can configure each block and choose to show it only on specific pages of your site and for specific roles as well, such as site admin, if you prefer. Configure each block and then...

Execute PHP code

To execute PHP code, click on the link and you'll be presented with a page that has a text area box where you can paste your PHP code. For example, go ahead and execute a simple PHP info script. Execute this code, but remember not to add any PHP tags. You do not need to surround your code with opening and closing PHP brackets. Just type or paste in Click on the Execute button. Your code will execute. The results will not look as pretty as the PHP info page you get through your Status report....

The Devel module

The Devel module provides a suite of tools for the Drupal theme and performance developer. Two major components of the Devel module include helper utilities that monitor performance of your site, and tools for themers that allow for quick and more accurate theme development. Developers can use the module to monitor all of the database queries that occur as each Drupal page loads. This tool will show you how many times the database query executes on each page when it loads. Knowing this is...

Checking your PHP and MySQL settings

You can also access your PHP and MySQL configuration settings via the Drupal Status report. For PHP it's as simple as clicking on the PHP version number, which is hyperlinked in your Status report. The same goes for your MySQL version and settings. Clicking on the PHP version link loads a php.info file that resides in your site. This will give you all of your PHP core configuration settings and all of the PHP extensions you have loaded and enabled on your server. It's good to review this file...

Backing up your site using Sftpftp and cPanel

Now that we have completed our initial investigation of the best practice methods for maintaining and monitoring our new Drupal 6.13 site, it's a good idea to run a full backup of the site directory all of our Drupal files and folders , and of the database. We did this in Chapter 1 before we completed our initial Drupal 5.x upgrade, but we're now going to look at this in more detail. Backups are essential to keep our site performing well over time. Eventually, you may run into an issue or...

Enabling and configuring the Throttle module

Drupal allows you to control when your modules and blocks get enabled and shown to your site visitors. This helps you to prevent bottlenecks in your server's web traffic and to optimize your server load to prevent any congestion that it might experience with its bandwidth and traffic. Throttling blocks and modules becomes increasingly important on larger scale websites where you have many blocks and modules active. You may have a site that contains a large number of blocks, for example, that...

Enabling the Garland theme sitewide

Before upgrading it's a good idea to disable your custom theme in this case we are using a sub-theme of Zen called 'Apollo' . Enable the Garland default Drupal theme the one you're currently using on the admin portions of the site for your entire site during the upgrade process. We're going to be deleting the entire Zen theme in order to upgrade it to the 6.x version of Zen, so let's disable it first. 1. Go to the Administer Site building Themes admin list and disable the Apollo theme. 2. Check...

Using Memcache API and Integration

In this chapter, we're going to return to our discussion of Drupal caching mechanisms and take a detailed look at the Memcache API and Integration contributed module along with the best methods of installing and configuring this module to allow for more granular and advanced cache configurations within our site. In Chapters 5 and 6, we used the Boost module to enable advanced caching for our anonymous site visitors. In this chapter and in Chapter 8, we're going to look at the best methods of...

Multisite resources

If you continue using Drupal multisite, you will want to investigate how to configure multisite in various different environments, such as Linux, Mac, shared and dedicated servers. Drupal.org provides a wealth of resources on the Drupal multisite topic. There's an entire Multi-site how-tos page on drupal.org that contains links to various resources on Drupal. Everything, from installing multisite in 10 minutes to running multiple domains or virtual hosts using different databases, is covered....

Page not found and access denied errors

The Dblog module also keeps tabs on your top 'access denied' 403 errors and top 'page not found' 404 errors. For access denied errors go to Reports Top 'access denied' errors at This will display a table that shows the Drupal page path that generated the access denied error and how many times it's been generated. In the following screenshot, you see that the admin path has generated access denied errors three times and the logout path has generated an error once. Keeping an eye on this it can...

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...

Clearing your performance cache

To clear your cache manually through the Drupal performance administration page go to Administer Site configuration Performance. Scroll to the bottom of the page and click on the Clear cached data button. This will clear your database cache tables. For example, if you click the button to clear the cache and then refresh your database cache_page table, you'll see that all of the previous primary key cid rows that were listed and that we covered above have been deleted. Go ahead and try this...

Session viewer

This shows you the contents of your session variable. Drupal session variables are variables that store site visitor information in the Drupal application framework for the entire length of the logged in user's session. So, as soon as you logout of the site, your session variable will expire. The variable may also expire after a certain period of inactivity on the website. These variables help to store information about a specific authenticated site visitor who is logged into your site. So,...

Testing your multisite configuration

Now that we have Drupal multisite working in our localhost environment, let's go ahead and test it to make sure all three databases and sites are working correctly and independently. First, go to your site2 site and login to it here http site2 user. Your username and password on this site will be the same as on your core site, as you simply duplicated the same database to use with this new multisite. Go ahead and login. Now, if you have caching enabled on this site, let's disable the caching...

Configuring the Authcache module

To configure the Authcache module settings, go to Site Configuration Performance Authcache or by visiting this URL http localhost drupal admin settings performance authcache. You should see a form that looks similar to this This settings page shows us that we can set caching for specific roles. You can set caching for all of your site's roles or just for specific roles such as anonymous users. The settings also tell you here that the super user admin role account will never be cached. Let's...

Devel settings

To enable more Devel module settings, including performance options, go to Site configuration Devel settings or to here http variantcube.com fire admin settings devel This is where you can configure Devel to collect database query information and display query logs. Follow these steps to configure performance logging 1. Check the box next to Collect query info if you want Devel to collect database query info. 2. Check the Display query log box if you want Devel to display a log of these...

Installing the Poormanscron module

It will become inconvenient to have to login to your site and run cron manually each time you want to clear stale data, re-index your search module, and perform other routine tasks. If you do not have access to set up a scheduled cron task on your server via cPanel or through other methods your host provides, you may want to consider installing the Drupal Poormanscron contributed module. This allows you to install a cron module and configure it to run scheduled cron tasks. The module's project...

Running cron manually

Another tip is to run your cron task often in order to clear out your database of stale data including old log entries saved through the Drupal watchdog module , cache entries that have not been cleared when you cleared your cache tables, and any other stale data. The cron task will also activate other maintenance tasks on your site and force these tasks to run, including re-indexing your site for the Drupal search functionality, force RSS feeds to refresh with new feed content and to update...

Updating your PHP memory limit

We're getting errors related to PHP memory, so we need to increase our memory_limit in our PHP settings. There are a number of methods of doing this. You can set a higher memory limit in your .htaccess, php.ini or settings.php files. We'll try doing this by adding a memory limit increase to our Drupal site's settings.php file first. There's more about tweaking Drupal PHP memory limits here http drupal.org node 2 0 7 03 6 1. Either login to your cPanel File Manager utility or to your site...

Enabling the Devel module block

When you install the Devel module, the module will add a block to your site that you can enable and use as a site admin. The block allows you to get to Devel module functionality quickly. To enable the block follow these steps 1. Go to Site building Blocks here http variantcube.com fire admin build block 2. In your disabled blocks region look for the Development block and configure it. On the configuration screen you can check the block for an authenticated user or a site admin role if you've...

Global Redirect

The Global Redirect module allows you to remove trailing slashes from URLs. It also checks to see if your Drupal site has clean URLs enabled and, if so, will prevent unclean URLs from ever being accessed. You can do a lot more with this module and all of the details are listed on its Drupal project page here http drupal.org project globalredirect. The module also redirects any specific node ID page to its alias if an alias exists. This is important, as your site will get requests by visitors...

Viewing your recent log entries

Having saved the configuration settings, launch the Recent log entries report pages by going to Administer Reports Recent log entries. This will launch the following page The logs will be displayed in a table by Type, Date, and the detailed log Message or error. Errors will be noted with a red X icon, and warnings will be flagged with a yellow exclamation point icon. For example, a php error will usually throw a red X line item, while a page not found error will show a yellow exclamation point...

Enabling Themer info

To enable the Themer info tool, click on the checkbox or anywhere in the gray rectangle. Once clicked, you'll see a second rectangle appear in the upper right corner of your site. This box tells you to click on elements on your page to see detailed information about the Drupal theme function and information about the template file that contains the theme function. Click ori any element to see information about the Drupal theme function or template that created it. As you move your mouse around...

Running updatephp

Immediately after moving your new Drupal 6.x core files over to your server and refreshing your site page, you'll see a bunch of parse errors. Don't panic Follow these steps to run your update.php script in order to update your Drupal database schema, so it updates to the latest Drupal 6.x configuration 1. Type in update.php at the root level of your site URL. So, for this site we'll have the following URL to run our script http variantcube.com fire update.php 2. Click the Return button on your...

Cache Router versus Memcache API

There are some drawbacks to using and configuring Cache Router in your site. Memcache API, as we discovered in Chapter 7, provides a nice administrative user interface and shows you statistics on each Drupal page. The Cache Router does not have an administrative interface and will not show you statistics in a visual mode. The project page advertises this with screenshots, but evidently this functionality has been removed from the latest Cache Router version. The module developer is working on...

MoWeS Portable development WAMP server

The first thing you'll want to do in order to follow these instructions is make sure you're running a WAMP localhost environment on your Windows XP system. I am using the portable application called MoWeS that installs Apache, MySQL, and PHP on your C drive so that you can run the Apache web server in a development configuration through your localhost. You can download the MoWeS Portable packages here To install MoWeS follow these steps 1. Visit the MoWeS website and go to the Download link. 2....

Installing the updated Zen theme files

We're going to install and upgrade the contributed Zen theme 6.x-1.0 so that we can reinstall and configure our Apollo custom theme files. The first part of this process is to install the main Zen theme folder in your sites all themes directory. 1. Download the 6.x version of the Zen theme from its project page here 2. Extract the file in your contributed modules directory on your desktop. 3. Connect to your site through FTP and browse to the sites all themes folder. 5. Now when you refresh...

Integrating and testing Memcached with PHP x

The first thing you need to do is check your PHP extensions directory to see if the Memcached extension is already installed. Go to c php5 ext directory and see if you can locate the php_memcache.dll file. If it's not there, you need to download it and paste it into your ext folder. You can get a copy of the DLL file here. This file works with PHP 5.2.x configurations com 2 0 08 06 17 php_memcache.dll. Now you need to tell your main php.ini file to reference the php_memcache dll extension. To...

Using the Memcache API and Integration module

The Memcache API and integration module provides an API for integration with the Memcached daemon or service. There are many methods of installing the prerequisites for using this module, specifically the Memcached library but we're going to focus on how to easily install Memcached and the Drupal 6.x version of the module in a Windows WAMP environment using PHP 5.2.x. In order to use the Drupal module, we'll need to first install the Memcached service on our local development server and then...

Boost and Poormanscron

Checking our Status report will show us that we're running an incorrect version of Poormanscron. Boost is optimized to work with the latest dev or 2.0 branch of Poormanscron. So let's go ahead and install the latest version so that our cron runs will work correctly with Boost. Boost poormanscron is the wrong version You need to get a newer version of poormanscron, most likely the latest dev, or the 2.0 branch Visit the Poormanscron project page and download the 6.x.-2. 0-beta1 release and...

Enabling the Memcache Admin module

Memcached Interface

Congratulations You now have the Memcache module running on your development site. Memcache API and Integration provides a sub module called Memcache Admin that gives you a simple Drupal-based admin interface to check on your Memcache stats and reporting. The module is located under your Caching modules section. Enable this module and save your module configuration. Once enabled, you can browse to this module's admin interface by going to Reports Memcache status through your administrative...

Cache Router

The Cache Router contributed module allows you to set up a caching system that assigns specific cache tables to specific Drupal cache technologies. This module works closely with the following cache technologies including Memcache API, the module we worked with in Chapter 7. Cache Router is a relatively new and promising module contributed by Steve Rude, available for download at http drupal.org project cacherouter. The module allows you to map specific caching technologies or engines to...

Boost advanced settings

Let's start looking at our advanced Boost configuration. The first item we want to note is that we can tell Boost to clear expired pages on cron runs. This will clear all expired cached pages when our cron runs. If you disable this, you will need to clear your Boost cache manually through the Boost Pages cache status block we looked at this block configuration in Chapter 5 . The next setting is even more flexible. Boost will only clear and flush expired content if it sees that there's been a...

Variable editor

Finally, the last link in the Development block is the Variable editor. This shows you all of the site variables that are stored in the database. This is a very helpful list. I can glance quickly through the alphabetical list looking for the site_name variable name and locate its value. The value is the name of our site, for example, Fire Trucks of Maryland and Pennsylvania. So, this table gives you the variable name along with its value. Another example is the administration theme we're using....

Advanced Boost settings

Let's do a quick review of our Boost configuration upto this point. We have set up Boost to cache our Drupal nodes. This stores our Drupal nodes as static HTML web pages. When an anonymous user visits our site, they are delivered the static HTML version of the web page, and this helps considerably with speed and optimization of our page loads. We have set our minimum cache lifetimes for HTML, XML, and JSON content to be 1 hour. We also have the option of clearing all of our Boost-cached data...

Configuring the Throttle module for auto throttling features

Go to Site configuration Throttle to load your Throttle module settings form or click on the throttle configuration page link through your main modules admin page. The Throttle configuration page explains what the Throttle module does and gives you a link to more information through the more help link. If you click on that link and have the Advanced Help module active, you will launch a detailed Throttle module help and explanation page. On this page you can configure three throttle elements...

Caching and multisite

As you work through these examples, you may notice that changes do not take effect immediately on each site or that if you make a change on site1 or site2, then those changes also take effect on localhost. This is not supposed to happen. But if you have caching enabled from your previous single site experiments using Memcache API, Memcached, or Authcache, you will need to disable those modules and also comment out your caching code from your settings.php files. You'll recall that the...

Enabling and configuring Drupal caching

We will first explore the Drupal cache options by looking at what Drupal core gives us out of the box in terms of caching and performance options to control and configure. To access your core performance cache administrative page go to Site configuration Performance. This will load the main Performance admin page. The first section of this page is devoted to Page cache. These settings control how your Drupal node content is being cached and stored by the Drupal system. There are 3 caching modes...

Authenticated User Page Caching Authcache

Let's take a look at another contributed module for caching. This module will allow us to configure caching for our authenticated users. It is frequently referred to as the Authcache module and the project page is here http drupal.org project authcache. The module will cache for both anonymous and authenticated users, and it will increase your page load and Drupal site performance because the page loads will be optimized to about 1-2 milliseconds according to the module project description . To...

Inspecting database queries and Devel results

Immediately after you save your Devel settings configuration, you should see the results. The Devel settings page will reload and you will see a message concerning the user being redirected to that page at its URL here. The user is being redirected to This shows you that the setting to show any redirections is working. This redirection did work. You'll also see a log entry on the page that shows the Views plugins build time. This would be more meaningful on a Drupal Views page that is using a...

Boost settings

Boost settings are split up into the following sections Boost cacheability settings Boost directories and file extensions All of these sections and settings are explained in detail on the Drupal module project Installation and Settings page here http drupal.org node 545 9 08. We're going to look at most of these configuration settings in detail. Most of the default settings will work for us here, but let's run through them all. We want to make sure that we have Boost - Static page cache set to...

Clearing the Boost cache

If you want to clear your Boost cache at any time and see how this affects the cache folder on your site, go to the Boost cache configuration page at Performance Boost Settings and click on the Clear ALL Boost cached data button and the Clear Boost expired data button. Since you started caching, these buttons will tell you how many pages they are caching respectively. This is another good example of the flexibility of this module. Clear ALL Boost cached data 9 pages Clear Boost expired data 5...

Clearing your theme registry

Another component of Drupal caching is the theme registry. Your theme and its associated functions and CSS elements can be cached by Drupal as it loads. Drupal stores this information as cached data. You may only need to worry about the theme registry if you are developing your theme and adding theme override functions to your template.php files and other Drupal theme template files. Drupal template files control all of the PHP and HTML output of your Drupal theme. These template files are...

Transliteration and Pathauto

This module can be enabled from your main modules admin list. The current version is 6.x-2.1. Go ahead and enable it on your site. The module does not have a configuration admin page in your Drupal site, but you can learn more about its configuration and what it does through its Drupal project page http drupal. org project transliteration. In a nutshell, this module provides transliteration resources for other Drupal modules including Boost, and also sanitizes your file upload names. For...

Creating a panel and adding content to it

To get started with Panels caching, make sure you have a Panel to use on your site. I'm going to go ahead and set up a Panel quickly and add some content to it, which we'll use to test the Panels caching mechanism. To create a new panel go to Site building Panels and click on the Panel page link to create a new panel. Give the panel an administrative title, machine name, and a path. Click on the Continue button. Choose a layout for your panel. Let's use the Two column bricks layout. Click on...

Cleaning up and resetting Views

The last thing to do in order to have a completely successful upgrade process is to carry out any content cleanup that's required and to reset your Views. Looking at our photo gallery content pages post-upgrade, I notice that the Lightbox2 imagecache settings were not implemented during the upgrade process. In order to use the correct Teaser and Full node display types, you may need to go back into your Photo Gallery content type and manage the Display fields configuration on your Photo tile...

Installing the Memcache API and Integration module

We're now ready to install the Drupal contributed Memcache API module into our Drupal site. Bear in mind here that this is a good starting point for you to work from. But the focus here will be on a Windows development environment using the MoWeS Portable Apache configuration. You may be using a different WAMP set up on Windows or using MAMP on a Mac. Your configuration may be different, so you can use this as a starting guide to getting Memcache up and running. There is an additional...

Clearing your Views module cache

If you are working with the Views module in your site, you'll want to know how to clear your Views module cache so that updates and tweaks you make to your Views via the Views 2 UI show up immediately. The Views module will cache existing View configuration, settings, and content, so if you're not seeing the changes you've made or are experiencing other issues with your Views, you'll want to make sure to clear the cache. Here are the steps to clear your Views cache 1. Go to Site building Views...