Caso você realmente precise fazer isso, use phpbrew.
Meus passos para instalar o php5.3 no Ubuntu 16.04 (funcionará para o 14.04):
Instale o link do phpbrew
Para criar o 5.3.24:
sudo phpbrew install 5.3.24 +bz2 +calendar +cli +gd +ctype +dom +iconv +fileinfo +filter +ipc +json +mbregex +mbstring +mhash +mcrypt +pcntl +pcre +pdo +phar +posix +readline +sockets +tokenizer +xml +curl +zip +mysql +debug +apxs2
O arquivo /etc/apache2/mods-available/php5.load deve conter
LoadModule php5_module /usr/lib/apache2/modules/libphp5.3.24.so
AddType application/x-httpd-php .php
Para ativar o módulo para o apache2:
sudo a2dismod php5.6 ; sudo a2dismod php7.0 ; sudo a2enmod php5 ; sudo service apache2 restart
Para instalar a extensão gd
phpbrew use php5.3.24
phpbrew ext install gd --with-gd=shared,/usr --enable-gd-native-ttf --with-gmp=shared,/usr --with-jpeg-dir=shared,/usr --with-xpm-dir=shared,/usr/X11R6 --with-png-dir=shared,/usr --with-freetype-dir=shared,/usr --with-vpx-dir=shared,/usr