Monday, October 14, 2013

Upgrade PHP 5.3.x to 5.4.x in UBUNTU 12.04

I wanted to use the Laravel in Ubuntu. So I decided to upgrade my php to a higher version. My current version was php 5.3 and I wanted to upgrade it to the latest stable at this time which is 5.4.

Here are the steps on how to do it:

  1. Be a root user and update the system first. Type:
  2.  
    sudo apt-get update
    sudo apt-get upgrade
    
  3. Add this repository that will update our php. If you want it to be the latest php version available use this:
  4.  
    sudo add-apt-repository ppa:ondrej/php5
    
  5. If you want the latest stable php version, use this:
  6. sudo add-apt-repository ppa:ondrej/php5-oldstable
    
  7. Now lets update our system again. Type these:
  8.  
    sudo apt-get update
    sudo apt-get upgrade
    
  9. I noticed that after upgrading the system. My php version is still the same. I also noticed that after upgrading the system "The following package will be as like it was.." which means that our update didn't really take effect. To fix this, we have to do one more command for the system to recognize our installation by:
  10.  
    sudo apt-get dist-upgrade
    

After that, type "php -v" and you should see our application to be updated to our preferred php version.

Reference: Ask Ubuntu Tutorial

No comments:

Post a Comment