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.

Subversion 1.7 on a shared hosting (InMotionHosting and GoDaddy Linux hosting with cPanel)

I have managed to install svn on a shared hosting successfully (on InMotionHosting's business hosting plan and GoDaddy Linux hosting with cPanel). I needed the subversion (client only) with https protocol support.

Increase phpMyAdmin's upload limit

When restoring MySQL db, using phpMyAdmin is handy. But the file size for upload is limited to 8MB. Here's how to increase the limit.

1. Locate php.ini
http://localhost/phpinfo.php shows where's the php.ini.

2. Edit php.ini
(optionally) memory_limit

3. Restart Apache
sudo apachectl restart

MAMP on Yosemite

After upgrading Lion on my MacBook Air to Yosemite, Apache failed to start. The solution is to rename (probably I could have deleted, but to be safe) the following file.


At first, just renaming seemed not working, but after a reboot, MAMP starts both MySQL and Apache no problem. Not sure why (or if) I needed to restart, though.

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

Java Socket with SSL

Here's 4 Java sample code.
Notice that the Connect class is the same for non-SSL and SSL server.

Socket Client

import java.io.*;
import java.net.*;

public class Client

public static void main(String[] args)
Socket soc = new Socket("", 51004);

// Input/Output stream
ObjectOutputStream oos = new ObjectOutputStream(soc

Syndicate content