Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough
Jan 17 2011
Jan 17

I ran into an odd error upgrading Drupal from 7.0 RC1 to 7.0. The following is the message in apache's error log:

[Mon Jan 17 13:49:47 2011] [apc-error] Cannot redeclare class queryconditioninterface in 
/var/www/drupal-core/drupal-7.0/includes/database/database.inc on line 1648.

The solution is to temporarily disable APC (for example, by commenting out the relevant lines in the PHP configuration. In my particular case, this in /etc/php5/conf.d/apc.ini).

Version info:

PHP Version 5.3.2
Ubuntu 10.04
APC 3.1.3p1
Apache 2.2.14

Postscript. This problem seems to be caused by APC's handling of require_once. I'd set up APC to optimize this handling, and it seems that something in either the new Drupal code, or the updated APC behaviour, is incompatible with the optimization, because the problem cropped up again with the newly installed Drupal 7 after I re-enabled APC.

For now, it appears that the fix is to turn off the include_once optimization: apc.include_once_override = 0

The moral of the story is: turn off opcode caches and acceleration while upgrading. Is that written in the installation/upgrade instructions? Maybe it should be...

Nov 28 2010
Nov 28

I speeded up page load times for my Drupal site by a factor of at least 10 with a couple of simple tweaks.

I measured page load times using the Safari Web Inspector. I also used the apache benchmark tool (ab) and
siege to load the server and get various statistics for transfer and latency times.

General advice

Make backups of data and configuration before undertaking these steps. Implement these steps one at a time. Do benchmarks before and after. Pay careful attention to logs (e.g., apache logs, Drupal logs, ...). Make sure your configurations persist and are correct across server restarts and system reboots.

PHP acceleration/opcode caching

This is the number one thing to do to enable performance improvements for most PHP based sites.

This requires making sure that your webserver's PHP handling has an opcode cache/optimizer/accelerator installed. In my case, this is Apache's mod_php module, which has the APC accelerator available as an extension. I downloaded and enabled the extension (in my case using the apt package manager for Ubuntu). Restart apache and verify by inspecting the output of phpinfo (the easy way to do this is to install the Devel module) that APC is enabled.

Apache gzip compression

While you're futzing with apache configuration, enable content gzip compression. This reduced the amount of data going over the network, which reduced page-load times for larger pages, since it takes a shorter amount of time for the page data to arrive at the browser.

To set this up, ensure that the mod_gzip apache module is installed. Enable it in your apache configuration (either in the apache configuration directory or per-site/per-directory in your .htaccess file). Add directives to your apache configuration to specify that HTML, CSS, JS files (at least) are compressed.

Drupal caching, Javascript/CSS compression

Turn on Drupal caching. As an admin, visit


(Drupal 5 and 6) or


for (Drupal 7).

Here you can adjust the caching for pages and blocks (enable these, unless your particular setup dictates otherwise), CSS and JavaScript aggregation and compression (again, enable these), and page compression (make sure that you don't compress the output of PHP scripts in your apache gzip/mod_deflate configuration in this case!)


The last option mentioned has potential for quite at bit of performance improvement; it's also potentially the trickiest to set up. This requires several steps:

  1. download, install and configure the memcache daemon
  2. download, install and configure the memcache or memcached (recommended) PECL extensions for PHP
  3. download, install and configure the Drupal memcache module
Sep 21 2010
Sep 21

This was one of those days where you set out to do something, and something else you've been meaning to do jumps in the way and gets done instead. I put off my blog post about setting up SQLite for testing on MacOS and fixed my Twitter module/OAuth setup instead.

After I posted my last blog entry about devoting Tuesday mornings to Drupal, I realized (for the n-th time) that my "Announce posts to twitter" feature wasn't working, and of course hasn't been working for a while since twitter has moved to oauth for its API authentication. Now, I'm all for that, and open/user-centric id and authentication in general. I even have a few trivial commits to the first incarnation of Drupal oauth module, and a bugfix in for Andy Smith's first OAuth PHP library. Still, broken is broken. General busy-ness and apathy had kept me from diving in there and trying to fix things...

Of course, with a rockin' community like Drupal's , coming back to something later often means that someone else has done some good work in the meantime, and this was no exception. The issue with Drupal's twitter module and OAuth authentication (especially comment #106, by designerbrent) clearly documents the setup required. After a bit of head-scratching (due to my not having paid attention to the required version numbers! You need OAuth module 2.02...), the new twitter and oauth modules (after applying the patch mentioned in the issue) have this all working beautifully again, much nicer than before, really. It would be really nice if the patch in question got committed :)

Sep 21 2010
Sep 21

One of the things that Dries said during his keynote at DrupalCon Copenhagen 2010 really stuck with me, and I've been trying to follow through. What he said was something like "if you don't schedule time to work on Drupal, it won't happen". Sadly, I've been finding this is true, so I decided I'd schedule three hours on Tuesday morning for Drupal. The plan is to wake up early-ish as usual, respond to email from my students, and then devote my morning to Drupal. Of course, I have some other work-related Drupal things happening, but this time will be for personal projects, the Drupal issue queue, and so on.

Apr 19 2010
Apr 19

I've updated and expanded the slides which I presented at DrupalCon 2010 San Francisco.

I'm now including some preliminary stats for Django (a python based framework), and at the request of @easement (Michael Billings) ground out stats on global variable use in Drupal releases from 4.6 through 7x.

Update: Antoine Beaupré (anarcat) kindly pointed out to me that my LoC slide for Drupal releases was pointing at the wrong numbers (off by one error in indexing!). This is now updated. I'm also posting the spreadsheet itself.

Another update:Mikey_p just pointed me to some metrics he has been working on which look at rate of features being added to Drupal 7: check out http://skitch.com/mikeyp/n9ke2/skitched-20100417-101751

AttachmentSize 251.63 KB 169.07 KB
Apr 08 2010
Apr 08

The image at left is a slide from a deck I'm putting together for possible lightning talk at DrupalCon SF. So far there are 11 slides showing the historical complexity of Drupal in terms of some simple metrics, and comparisons with the current release of Joomla!. The point of this is to try to understand the complexity of Drupal, both historically and in comparison with other frameworks, in terms of software metrics.

Comments, questions, pointers, and insights/opinions are very welcome.

BTW - The Joomla metrics (and the Drupal 7x) metrics are probably not quite right, yet - this is a work in progress. I'm working on metrics for Wordpress and a few other platforms also.

UpdateI presented this at DCSF - thanks to everyone who commented and discussed this with me. The attached file is slides as presented Sat Apr 17, 2010.

AttachmentSize 207.79 KB
Mar 25 2010
Mar 25

Most of my posts and content on the topic of
teaching and learning, mathematics,
and computer science will be posted at my
site http://teaching.puregin.org.
Follow me there...

Mar 24 2010
Mar 24

This shouldn't be construed as an official posting, but we (the UBC Math department, that is) are hiring to fill a full time, one year temporary position (w/ possible renewal) to do web application development, preferably in Drupal, and to coordinate with other departments on campus to collaboratively build open-source infrastructure components and common applications.

I think this is pretty cool, and a great opportunity for the right person - someone who is competent in Drupal development, is self-directed, who communicates and works well with end-users, developers, managers and clients, and who has a good track record with the community. I'm looking forward to working with this person to show just how well Drupal/OSS can work as a development platform/process for rapid development on campus.

Interested? Please email me [djun.kim] at [cielosystems.com] with a current resume describing Drupal experience (code and community). You must be ready to interview in Vancouver in the next week.

If you've recently emailed me, please resend to the address above. Our department mail server is just a bit over-zealous with spam filtering!

AttachmentSize 66.78 KB
Mar 15 2010
Mar 15

I'm about to meet with a group of eight or nine IT administrators in the Faculty of Science at UBC, about collaboration on areas of mutual interest via common open-source platforms. Since the adoption of Drupal at UBC has in the last few years skyrocketed, I imagine that this will be one of the first opportunities for collaboration.

Many individual and departments have of course been well-aware of the benefits of open source software, but it feels like the time is right to try for some economies of scale in terms of inter-department sharing and collaboration.

The following is a list of actions I'd like to see happening over the near term. I'd love to hear from anyone are engaged in similar projects, about things that worked, things that didn't work so well, or anything else you would like to share.

  1. Communicate regularly to exchange knowledge about OSS software and and realize opportunities for collaboration around OSS platforms
    • set up a chat room (irc? xmpp? skype?)
    • set up an email list?
  2. Seek areas of common need which can be addressed by shared OSS
    platforms, and work towards standardizing on these
  3. Collectively and individually publish and promote our goals,
    discussions, and results of our collaboration
    • set up a public wiki, and repository (trac)
    • set up twitter lists
    • blog
  4. Advocate for the contribution of code, documentation, and other
    resources to 'upstream' open source projects
  5. Meet regularly with other open source interest groups on campus and beyond
    • host meetings
  6. Educate our bosses, colleagues, users, and others about the
    benefits and advantages of adopting and supporting open source
    • report on adoption, savings, opportunities realized
Feb 27 2010
Feb 27

This week I gave a talk for the Vancouver Island Java User Group on integrating Apache Solr search into web applications. Since the group is, of course, Java-focused, I didn't dwell overly much on Drupal except to demo a non-trivial example of integration showing some of the more advanced capabilities of Solr search, including faceted search, search spelling correction, "find similar content", and so on - all available out of the box with Robert Douglass, pwolanin, claudiu.cristea et al.'s excellent ApacheSolr module for Drupal.

Slides are available here.

Since I was originally schedule to give the talk in November of 2008, this was a great opportunity to look back over the past year and a half or so and see what has changed in the Solr and ApacheSolr world.

Solr has had two major point releases, going from version 1.2 to 1.4, adding substantial performance improvements, replication, multi-select faceting, range queries (e.g., date between Sep 2004 and Oct 2006), nested queries, multiple cores, more flexible architecture, and much more. The number of installations and the community of developers seems to be steadily growing - I'd estimate that the numbers have at least doubled in the past 16 months.

ApacheSolr has had steady development releases, leading to full DRUPAL-5--2 and DRUPAL-6--1 and DRUPAL-6--2 releases. More than 240 issues and feature requests have been addressed since Jan 2009. Many issues including indexing of attached documents, access control, implementation of various Solr features, have all been addressed in one or more ways by this or various associated modules.

One of the issues that seems to come up relatively frequently is the difficulty of using Solr's fuzzy matching or wildcard matches out of the box, because the ApacheSolr module chooses to use the DisMax query handler rather than the "Standard" query handler for Solr, in order to better deal with weighted fields, if I understand the rationale correctly (i.e., a core use case trumps a special use case). This situation may soon improve with proposed improvements to the DisMax handler. Let's hope so (better yet, in the magical event of a sudden rush of free time or significant client interest, pitch in and help make this happen!)

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web