PHP 5.6 7.0 7.1 7.2 7.3 7.4 on Ubuntu Servers with Virtualmin

In this tutorial, we are going guide you, how to install multiple PHP versions on a Virtualmin server running ubuntu.
php installation on ubuntu with virtualmin


So we are going to install multiple PHP on Ubuntu & Virtualmin with this guide. login as root and run the below commands.


Adding Third party PPA

add-apt-repository ppa:ondrej/php

Once you run that command, you should see a prompt from the system to press enter to add the repository., go ahead.


Update and Upgrade.

aptitude aptitude full-upgrade

If aptitude is not installed on your system, go ahead and install that first

apt install aptitude

sudo aptitude install pkg-php-tools php5.6 php5.6-cgi php5.6-cli php5.6-dbg php5.6-common php5.6-curl php5.6-gd php5.6-imap php5.6-intl php5.6-mysql php5.6-pspell php5.6-sqlite3 php5.6-tidy php5.6-opcache php5.6-json php5.6-bz2 php5.6-mcrypt php5.6-readline php5.6-xmlrpc php5.6-enchant php5.6-xsl php-all-dev php php-cgi php-cli php-common php-dbg php-curl php-enchant php-gd php-imap php-intl php-ldap php-mcrypt php-readline php-pspell php-tidy php-xmlrpc php-xsl php-json php-sqlite3 php-mysql php-opcache php-bz2 libapache2-mod-php


PHP5.6, PHP7.0, PHP7.1

aptitude install pkg-php-tools php7.1-xml php7.1-xsl php7.1-mbstring php7.1-readline php7.1-zip php7.1-mysql php7.1-phpdbg php7.1 php7.1-sqlite3 php7.1-tidy php7.1-opcache php7.1-pspell php7.1-json php7.1-xmlrpc php7.1-curl php7.1-ldap php7.1-bz2 php7.1-cgi php7.1-imap php7.1-cli php7.1-dba php7.1-dev php7.1-intl php7.1-fpm php7.1-recode php7.1-odbc php7.1-gmp php7.1-common php7.1-pgsql php7.1-bcmath php7.1-snmp php7.1-soap php7.1-mcrypt php7.1-gd php7.1-enchant libapache2-mod-php7.1 libphp7.1-embed
aptitude install php7.0-xml php7.0-xsl php7.0-mbstring php7.0-readline php7.0-zip php7.0-mysql php7.0-phpdbg php7.0 php7.0-sqlite3 php7.0-tidy php7.0-opcache php7.0-pspell php7.0-json php7.0-xmlrpc php7.0-curl php7.0-ldap php7.0-bz2 php7.0-cgi php7.0-imap php7.0-cli php7.0-dba php7.0-dev php7.0-intl php7.0-fpm php7.0-recode php7.0-odbc php7.0-gmp php7.0-common php7.0-pgsql php7.0-bcmath php7.0-snmp php7.0-soap php7.0-mcrypt php7.0-gd php7.0-enchant libapache2-mod-php7.0 libphp7.0-embed

aptitude install php5.6-xml php5.6-xsl php5.6-mbstring php5.6-readline php5.6-zip php5.6-mysql php5.6-phpdbg php5.6 php5.6-sqlite3 php5.6-tidy php5.6-opcache php5.6-pspell php5.6-json php5.6-xmlrpc php5.6-curl php5.6-ldap php5.6-bz2 php5.6-cgi php5.6-imap php5.6-cli php5.6-dba php5.6-dev php5.6-intl php5.6-fpm php5.6-recode php5.6-odbc php5.6-gmp php5.6-common php5.6-pgsql php5.6-bcmath php5.6-snmp php5.6-soap php5.6-mcrypt php5.6-gd php5.6-enchant libapache2-mod-php5.6 libphp5.6-embed

Configuring Apache for PHP

nano /etc/apache2/mods-available/php7.1.conf 
nano /etc/apache2/mods-available/php7.0.conf 
nano /etc/apache2/mods-available/php5.6.conf

In the above files these two lines.. like below..

#SetHandler application/x-httpd-php 
#SetHandler application/x-httpd-php-source

You can also use the command below, it would search all the files which has this so that you can remove them explicitly.

find /etc/apache2 -type f | xargs grep -i sethandler


PHP packages/modules

apt-cache pkgnames | grep php7.0 
apt-cache pkgnames | grep php5.6 
apt-cache pkgnames | grep php7.1


Disable Mod_php mode.

#php_admin_value engine Off

you can search the folder, then find and replace with the below command.. if you already had lot of websites..

find /etc/apache2 -type f | xargs grep -i php_admin_value 
sed -i 's/php_admin_value/#php_admin_value/g' /etc/apache2/sites-available/


Uninstalling PHP and revert to default.

apt install ppa-purge ppa-purge ppa:ondrej/php

„Block lists“ is basically the oposite what the „allow list“ is but with more options. You can add IP’s or Email addresses directly to a „Deny List“, set a „Spamm Words List“ and many more lists which are having different criteria on why should get banned.

Notify of
Inline Feedbacks
View all comments
Register New Account
Reset Password
Compare items
  • Themes (0)
  • Plugins (0)
  • Deals Platform (0)
  • FB Groups (0)
  • CDN (0)
  • PHP Scripts (0)
  • Hosting (0)
  • Web Panel (0)
  • Marketing (0)
  • Saas (0)
  • eCommerce (0)
  • Social Media (0)
  • Web Security (0)
  • Open Source Tools (0)
  • CMS (0)