HostOnNet Blog

Install PHP 5.6 on Ubuntu 16.04

Ubuntu 16.04 comes with PHP 7.0 by default.

To install PHP 5.6, you need to enable PPA

sudo add-apt-repository ppa:ondrej/php

Now you can install PHP 5.6 with

sudo apt-get update
sudo apt-get install php5.6 php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml php5.6-intl php5.6-intl php5.6-mbstring  php5.6-cli php5.6-gd php5.6-curl php5.6-sqlite3

To install apache module, run

apt install libapache2-mod-php5.6

If you have PHP 7 installed, it won’t activate php 5.6 module. To activate, run

a2dismod php7.0
a2enmod php5.6

Now restart apache

service apache2 restart

Posted in Ubuntu