Specify php path (version) for Drush


I have set up drush on a shared hosting server, but one day, it suddenly stopped working. When I type drush, there's no output (just get the command prompt back).

It turns out that the default php version on the hosting server was 5.2, and for whatever reason, it doesn't contain Phar module now (not sure if it did, or something else had changed).

Running Postfix on Mac (El Capitan) with Gmail 2 step authentication


When testing Drupal on a local machine, it is handy to set up Postfix so that email capability can be tested.

Here's the steps, mostly from http://benjaminrojas.net/configuring-postfix-to-send-mail-from-mac-os-x-... , but modified to work with Gmail 2 step authentication.

0. Delete failed email

Drupal 8 Installation Memo

1. Download and configure the site as Drupal 7 (hostname, VirtualHost, Directory).
2. For MAMP, configure the preference to choose PHP 5.4 (or above), and disable cache.
3. Go to the site root folder from a browser.
4. Follow the instruction. A new database will be created.

Compass on Yosemite

After upgrading Lion on my MacBook Air to Yosemite, I started to see the following error when running compass.

$ compass
-bash: /usr/bin/compass: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory

Using GD library PNG support on Mac OSX Yosemite


When I upgraded to my main machine to Yosemite, I've encountered a case that some images on Drupal installation doesn't generate image-style images. The status page shows that the GD library was not complied with PNG support.

The solution is to install the latest php. I followed the following page, basically to install php55 using home brew.

Installing Drush on Bluehost/Fastdomain


Installing Drush on the shared hosting server, such as Bluehost, is tricky. Here's what I did for Bluehost.

1. Install Composer
curl -sS https://getcomposer.org/installer | php

In my case, this created composer.phar on the home (current) directory. Moved it to ~/bin.

2. Check if composer runs

A sample migration module - importing menu from CSV

It took some time for me to write a migrate module that imports menu links from a csv file. A seemingly simple task, but there was no sample available when I googled it. So, here it is.

class mySampleMenusMigration extends Migration {
public function __construct() {

Using Drush on Mac with MAMP


Just got stuck with this. When using MAMP and Drush, you need to specify the PHP path so that both use the same PHP.


Basically, you just need to export DRUSH_PHP in .bash_profile.

export DRUSH_PHP="/Applications/MAMP/bin/php/php5.2.17/bin/php"

Run source ~/.bash_profile to take it effect.

Drupal Mobile Tools Memorandum


To make Mobile Tools work with mobile sub domain, there are some tricks. Say, you want to have www.example.com for the full (desktop) site, while m.example.com is for mobile.

In that scenario, set the Mobile Tools settings as follows.
- Mobile URL -> m.example.com
- Desktop URL -> www.example.com
- Enable automatic redirection -> On (checked)

How to specify the thumbnail image for a 'Liked' page on Facebook

Here's the answer.


The gist of that is

  1. Use a meta tag to specify the image
  2. <meta property=”og:image” content=”your image url here”/>

  3. Use Facebook Debugger to update the image, if necessary.
Syndicate content