Drupal tips

Command line Drupal install and update script for multi-site hosting

Maintaining a Drupal site, or a collection of sites is much easier if everything is kept completely separate--Drupal core, contributed modules, and the site itself.
This is even more important if multiple sites are hosted on the same server. Drupal's own multi-site support can be a nightmare to maintain, believe me! (e.g. when you want to upgrade modules or core).
A must simpler and easily supported configuration is to keep everything separate and to use symbolic links to tie it all together. For example, I keep:

Technical Notes

These notes are my personal online notebook of useful commands and "how-to's". You are welcome to make use of them if you find them helpful. They obviously don't come with any warranty! Click on one of the category tags above for the notes in any category.

Upgrading CentOS 6 to PHP 5.4 (or 5.5)

  • SCL is the way to go since it has RedHat’s blessing

Note that it is the .conf file that controls which version of php is used. For some reason this does not seem to be available for php55.

Add mobile theme to Drupal site

This method will allow mobile users to be redirected to another url which shows a site based on the same database but with a different theme.

  • A key advantage with this method is that since mobile pages have a different URL there is not a caching problem.
  • They can be linked together in Google Analytics with one of the urls defined as cannonical.
  1. Create a mobile domain within the /sites directory.
    • e.g. /sites/m.nlife.ca
  2. Copy /sites/default/settings.php into the folder created above
  3. Add a /themes subdirectory containing the mobile theme
    • e.g.

Installing Foundation on a bare Ubuntu 14.04 system

Purpose of tools and their dependencies

  • Bower
    • Function: to keep web assets up to date
      • Updates local versions of CSS, JS and HTML (i.e.

Installing Drupal on Ubuntu 16.04

  • Install LAMP stack
apt-get install openssh-server
apt-get install tasksel
tasksel install lamp-server
  • Some basic stuff

Webform formatting

As I wrote here:www.drupal.org/…omment-9134347

Webform descriptions can be made to take any tags using:

php -r "print json_encode(array('a', 'em', 'strong', 'code', 'img', 'ul', 'ol', 'li'));"  | drush vset --format=json webform_allowed_tags -
  • The first command generates:
  • which can be written to the variable and checked with:
drush vset --format=json webform_allowed_tags '["a","em","strong","code","img","ul","ol","li"]'
drush vget webform_allowed_tags  # check value is set


So far CloudFlare has proved to be an excellent service. It is very useful for providing extra safety for old Drupal 5 sites that have not yet been upgraded.

JavaScript MVC Frameworks

A new way of creating a website is using what is sometimes called a “headless” site, with the front end being served by an MVC framework (Model View Controller).

Headless Drupal means using Drupal purely for content creation and management and feeding all the data in JSON format to a JavaScript front end.

Installing Open Atrium


  • download no-core version
  • replace all modules in repo with symbolic links
  • create standard Drupal 7 site
  • link openatrium directory into profiles/openatrium
  • install site using openatrium install profile
dget install openatrium 7.x-2.19-no-core d7paths
grep memory_limit /etc/php.ini       #should be >= 256M
grep max_allowed_packet /etc/my.cnf  #should be >= 32M (add under [mysqld]}
  • Go through OA contrib modules and any we have already replace with the one in the repo

function repoa {
  rm -Rf $oa/modules
Syndicate content