These are the steps to upgrade to PHP 5.6:
Add the PPA containing version 5.6 of php for Ubuntu 12.04:
sudo apt-add-repository ppa:ondrej/php5-5.6 sudo apt-add-repository ppa:ondrej/php5
Run these command in terminal to upgrade php :
sudo apt-get update
If everything works great, you have successfully upgraded to php5.5.
If an error occurs like file already exists in your apt cache, in this case run these command to overwrite cache files:
sudo apt-get clean all sudo apt-get -o Dpkg::Options::="--force-overwrite" -f install sudo apt-get clean all
Upgrade and delete old version of apache:
Delete old apache2 version:
Make note of the enabled modules in the current version of your Apache HTTP Server instance (copy file names to any text file):
cd /etc/apache2/mods-enabled/ ls -al > ~/enabled-mods.txt
Stop any existing instance of the Apache HTTP Server:
service apache2 stop
Delete the directory containing the Apache HTTP Server configuration (make a backup before deleting files):
rm -r /etc/apache2/
Remove the existing installation of the Apache HTTP Server:
apt-get remove apache2 apt-get purge apache2 apache2-utils apache2.2-bin apache2-common apt-get autoremove
If you are sure about what you are trying to remove, you can run this command (at your own risk to remove everything having apache2 as prefix):
apt-get remove apache2*
Upgrade apache :
Add the PPA containing version 2.4 of Apache HTTP Server for Ubuntu 12.04:
sudo add-apt-repository ppa:ondrej/apache2
Run this command to install apache2:
sudo apt-get install apache2 apache2-doc apache2-utils
Install apache php module:
sudo apt-get install libapache2-mod-php5
Run following command to check updated version:
php -v apache2 -v
Start apache:
service apache2 start
Check http://localhost in browser to see apache configuration
Webner Solutions is a Software Development company focused on developing CRM apps (Salesforce, Zoho), LMS Apps (Moodle/Totara), Websites and Mobile apps. If you need Web development or any other software development assistance please contact us at webdevelopment@webners.com
Thanks for the howto, there is only one error you need of a
#sudo apt-get update
after the command
#sudo add-apt-repository ppa:ondrej/apache2
without it apache 2.2 will reload from original repository.