Search blog

Wednesday, September 28, 2016

Updating PHP 5.5.x with PHP 5.6 or PHP 7.0 in Ubuntu 13.04, 14.04, 15.04

After trying a couple of packages, settings and configuration, finally I seem to have found out a working solution:

1. Update your PPA repository with the  PHP 5.6 package sources:

 sudo add-apt-repository ppa:ondrej/php

Please note the repository is as stated above and not as:

 ppa:ondrej/php5-5.6 because this has been deprecated where the above PPA is a co-installable one, meaning you can install PHP 5.5, PHP 5.6 or PHP 7.0 as per your requirement.

Press enter to confirm. If you come across any error then you will need to install python-software-properties first as shown below:

 sudo apt-get update  
 sudo apt-get install python-software-properties  

2. Update

Once again update your packages:

 sudo apt-get update  

3. Install PHP 5.6 and its relevant mods:

 sudo apt-get install php5.6 php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml   
 sudo apt-get install php7.0 # for PHP 7.0   
 sudo apt-get install php5.5 # for PHP 5.5   

4. Disable PHP 5.5:

Now this step is very important else you won't be able to use PHP 5.6. Even when you check your PHP version, it will still display as PHP 5.5. Follow the step below to disable PHP 5.5.

 sudo a2dismod php5  

5. Enable PHP 5.6:

 sudo a2enmod php5.6  

6. Restart Apache web server:

 sudo service apache2 restart  

Note: New location of php.ini file in PHP 5.6:

The location of php.ini fie is changed in PHP 5.6 unlike PHP 5.5 where it used to be located at '/etc/php5/apache2/php.ini'; the new location is at '/etc/php/5.6/apache2'

No comments:

Post a Comment

Thank you for your Feedback!

Top 5 Posts (Weekly)