I successfully installed PHP 5.3.29 on Ubuntu 14 with Apache 2 separately.
I installed PHP with the following method:
sudo -i
wget http://in1.php.net
This works for me on a scratch Ubuntu 14.04:
Update the systems packages
apt-get update
apt-get upgrade -y
Install the dependencies and prepare environment
apt-get install -y build-essential libxml2-dev apache2 apache2-dev
echo "export PATH=/usr/local/bin:/usr/local/sbin:$PATH" >> ~/.bashrc
apt-get install -y libapache2-mod-php5 --no-install-recommends
Download PHP 5.3.29
apt-get install -y wget && cd /tmp && wget http://php.net/distributions/php-5.3.29.tar.bz2
Unzip and configure apache's module apxs2
tar -xvf php-5.3.29.tar.bz2 && cd php-5.3.29 && ./configure --with-apxs2=/usr/bin/apxs2
Install it
make && make install
Check if works
service apache2 restart && php -v