Throttling blocks

You can also throttle your 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...

Files to delete and clean up

Your Status report tells you that your update.php file is protected. This is good as you do not want anyone to launch your Drupal site and try running update.php to update your database schema. You only want to do this as a super user admin. Another tip is to delete your install.php file from your Drupal site. You do not need to keep the install.php file on your production site. Removing it is a good precaution and the added benefit is that no unauthorized site user can try and run your...

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

Reinstall modules

This is another Development block tool that you need to be careful with. It provides easy access to your modules admin, and you can select any of your core or contributed modules and reinstall them here. But beware that if you do this, the module reinstallation will wipe out and override any customizations you had made. Reinstalling modules will also wipe out any data you have in your module's database tables, so be sure to only use this functionality if you know what you are doing as an...

Backing up and exporting your Drupal x Views

Drupal 5.x uses Views version 1.x. 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...

Viewing the Memcache tables in MySQL

The Memcache API utilizes your default Drupal cache tables in your MySQL database if you are using the memcache.db.inc file and configuration. If you view your Memcache module statistics per Drupal page, you'll see that the statistics show the module referencing the MySQL cache tables via the bins section. These include cache, cache_filter, and cache_menu. If you view your MySQL database via phpMyAdmin, you'll see the cache tables. This is a nice flexible feature, as this module does not insert...

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

Enabling the Update Status module

Remember that when we ran our Drupal 5.x site, we had to install the contributed Update Status module in order to get status notifications on our site's modules. This module now comes packaged with Drupal 6.13 core. So all we need to do is enable it. We see the module is currently disabled by checking our Status report and viewing the notification that the module is disabled i Update notifications Not enabled Update notifications are not enabled. It is highly recommended that you enable the...

Checking Devel module permissions

Another item to check before you or any of your site admins start using the Devel module features and the Development block discussed later in this section are the permissions to use the module. Go to User management Permissions and look for the Devel module permissions. Make sure you have checked the appropriate permissions for your site admins or other admin roles. This may include allowing them permissions to You may also give them permissions to view devel_node_access_information as part of...

Using Drupal multisite

What is Drupal multisite and why should we use it Multisite allows you to run multiple Drupal websites and instances from one main Drupal core codebase. As we have seen throughout this book, when we install and configure Drupal, we are using Drupal's main core system and database to power and drive our website. This includes the core modules and themes folders, as well as scripts, profiles, misc, and includes. The flexibility of Drupal allows us to install additional websites as many as we need...

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

Multisite Configuration and Performance

In this final chapter, we are going to set up and configure a Drupal multisite environment on our localhost development server. The benefits to running a multisite installation include allowing multisites to share one Drupal database and core module configuration, or to share a core module configuration and allow each site to have its own database. We will also look at how multisite installations can help to boost performance for your overall Drupal configuration and help to increase...

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

Hookelements

Hook_elements launches a page that displays all of your hook arrays. This will be presented in a nice Krumo-based screen using the orange skin we selected when we configured our Devel module. You can click on an array in the table to view its corresponding elements. Array, 36 elements form Array, 2 elements Umethod String, 4 characters post faction String, 20 characters ffire devel eleinents sul mit Array, 5 elements input Boolean TRUE ff n a me String, 2 characters op button_type String, 6...

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

Running cron and checking recent log entries

Before proceeding with the upgrade to Drupal 6.x, complete the following steps 1. Run cron again here admin logs status. 2. View recent log entries to make sure you're not getting any parse errors or other errors in your current Drupal 5.19 site. It's a good idea to check and try to get as few errors as possible in your recent log reports before upgrading to Drupal 6.x. This will make the process go smoother. 3. To check recent log entries, go to Administer Logs Recent log entries. Your report...

Installing contributed module updates

Remember that you need to update your contributed modules to the latest 5.x released versions before attempting to upgrade your Drupal site to 6.x. Before upgrading the 5.x versions of contributed modules, it's a good idea to back up your site files and database once more now that you're at the core Drupal 5.19 release. 1. Download the latest stable release of the Imagefield, Lightbox2, and Webform modules. The Project pages are here 2. Copy the extracted folders to your sites all modules...

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

Views caching

Title Antique Fire Apparatus amp Muster, Harrisburg, PA Style Grid Row style Fields Use A J AX No Use pager Yes Items per page 24 Distinct No Access Unrestricted Exposed form in block No Header None Footer None Empty text None Theme Information Click on the None link. Select the Time-based radio button. This will enable Time-based caching for our View page. Click the Update default display button. The next caching options configuration screen will ask you to set the amount of time for both,...

Installing and configuring Boost

Installation and configuration instructions are provided on drupal.org and also in the module's readme file. Read these in detail before installing and enabling the module http drupal.org node 545908. Additionally, the module notes specify that the module will install and enable using smart defaults and these should work fine in most shared server environments. We'll look at the default settings in this chapter and how to make more advanced configurations in Chapter 6. Follow these steps to...

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

Tweaking your HTACCESS file

Your site directory contains an .htaccess file that sits at the root level of your Drupal site. This fiile comes packaged with the Drupal install and gets installed with Drupal by default. You can view and edit this file using your cPanel or SFTP, if you fifirst change its permissions to write permissions as it's a ready-only file. Your .htaccess fiile allows you to tweak directory permissions, specify how Drupal handles error messages, and present errors 404 errors to the end user. You can...

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

APC Alternative PHP cache

At the time of writing, the APC module has been revoked for Drupal 5 and 6.x. This is due to the fact that APC will be included in Drupal 7 with the Drupal 7 caching system. The Drupal 7.x caching system will allow for custom cache backend configuration, thus making the module unnecessary and not supportable in earlier versions of Drupal. The module maintainer informs the developer that they can use other caching modules, such as Cache Router, to perform similar caching operations. See the APC...

Uninstalling and removing Update Status

Before proceeding with the full version upgrade to Drupal 6.x, we must uninstall and remove the Drupal Update Status module. This module comes packaged with Drupal 6.x core, so we cannot leave the 5.x version of the Update status module in place. 1. Go to your modules admin page Administer Site Building Modules . 2. Uncheck the Update status module checkbox and save the module configuration. This will disable the module. 3. Click on the Uninstall tab at the top of your modules page. This will...

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

Maintaining your Drupal Site

Now that you have upgraded to Drupal 6.13, you're ready to learn how to maintain the site, keep it running smoothly on a regular basis, and enable some performance enhancements that we will continue to monitor. This chapter will show you a selection of best practice Drupal maintenance tips and tricks that you can enable using the core Drupal administration interface. These performance enhancements will help you to run a powerful and well-maintained Drupal site. Running a Drupal website is like...

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

Tweaking your settingsphp file to support Authcache

Based on the warning message we see once we enable the Authcache module, we need to make some tweaks to our settings.php file to reflect the change to our conf array for our cache_inc. As you recall we're currently using the Memcache API module and referencing this in our conf array. We need to tweak this and reference our new Authcache module, and also add a reference to our Memcache so that we can use both of these integrated. Open your settings.php file and comment out the previous array you...

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