php 5.3, 5.4, 5.5 upgrade/downgrade in ubuntu 12.04


The start is from php 5.3.10, a ubuntu 12.04 default version.
 
Upgrade to 5.4.x 
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php5-oldstable

sudo apt-get update
sudo apt-get install php5


Upgrade to 5.5.x 
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php5
sudo apt-get update
sudo apt-get install php5

Downgrade to 5.4.x from 5.5.x
sudo apt-get install -y ppa-purge
sudo add-apt-repository -y ppa:ondrej/php5-oldstable
sudo apt-get update
sudo ppa-purge ppa:ondrej/php5
sudo apt-get update
sudo apt-get upgrade -y 
sudo apt-get autoremove -y 
sudo apt-get autoclean

Downgrade to 5.3.x from 5.5.x
sudo apt-get install -y ppa-purge
sudo ppa-purge ppa:ondrej/php5
sudo apt-get update
sudo apt-get upgrade -y 
sudo apt-get autoremove -y 
sudo apt-get autoclean


Downgrade to 5.3.x from 5.4.x
sudo apt-get install -y ppa-purge
sudo ppa-purge ppa:ondrej/
php5-oldstable
sudo apt-get update
sudo apt-get upgrade -y 
sudo apt-get autoremove -y 
sudo apt-get autoclean


Uninstall an installation
Manually delete all the files/folders with php find by whereis


Install specific version using tar.gz
If you want to do a manually installation. You must uninstall the installation first as described in the  "Uninstall an installation". 
As the upgrade and downgrade will always update to a latest version of 5.4 and 5.5, when you want to update to a specific 5.4.x or 5.5.x version (or the latest version still not in the repository). Then you need to install it manually. And you can do it as below:
(The latest list of available version in the repository is here http://php.net/releases/, but maybe not the fresh latest version.)
So if you want to update to a designed version, you need to download the tar ball and compile it by yourself if you can not wait for the update of a ppa repository.
Download the latest tar.gz to update:
a) Download the latest tar ball here
b) Extract to a folder  php-5.4.x where you want to install the php 5.4.x.
c)  cd to the folder php-5.4.x.
d)  Check the INSTALL file in the downloaded folder to see the installation construction.
e) Normally, it is as following:
./configure --with-mysql (this is with mysql extensions enabled, if you want also with apache, you can  use others, you can use ./configure --help to check how to use others )
f)  sudo make
g) sudo make install
h) php -v, you can use this to  check whether you update to the version that you want.


Comments

Popular posts from this blog

install ipython in Cloudera VM using pip

install postgreSQL in ubuntu 16.04

Install MYSQL 5.6 in ubuntu 12.04/14.04 and set password and remote access