Ubuntu : Install PHP5.6 & PHP7.4

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update

For PHP5.6

sudo apt install php5.6 php5.6-amqp php5.6-bcmath php5.6-bz2 php5.6-cgi php5.6-cli php5.6-common php5.6-curl php5.6-dba php5.6-dev php5.6-enchant php5.6-fpm php5.6-gd php5.6-gearman php5.6-geoip php5.6-gmp php5.6-gnupg php5.6-grpc php5.6-http php5.6-igbinary php5.6-imagick php5.6-imap php5.6-inotify php5.6-interbase php5.6-intl php5.6-json php5.6-ldap php5.6-lua php5.6-lz4 php5.6-mailparse php5.6-mbstring php5.6-mcrypt php5.6-memcache php5.6-memcached php5.6-mongo php5.6-mongodb php5.6-msgpack php5.6-mysql php5.6-mysqlnd-ms php5.6-oauth php5.6-odbc php5.6-opcache php5.6-pgsql php5.6-phalcon3 php5.6-phpdbg php5.6-propro php5.6-protobuf php5.6-ps php5.6-pspell php5.6-radius php5.6-raphf php5.6-readline php5.6-recode php5.6-redis php5.6-rrd php5.6-smbclient php5.6-snmp php5.6-soap php5.6-solr php5.6-sqlite3 php5.6-ssh2 php5.6-stomp php5.6-sybase php5.6-tidy php5.6-uploadprogress php5.6-xcache php5.6-xdebug php5.6-xhprof php5.6-xml php5.6-xmlrpc php5.6-xsl php5.6-yaml php5.6-zip php5.6-zmq php5.6-zstd

For PHP7.4

sudo apt install php7.4 php7.4-cgi php7.4-cli php7.4-common php7.4-curl php7.4-dev php7.4-gd php7.4-gmp php7.4-json php7.4-ldap php7.4-mysql php7.4-odbc php7.4-opcache php7.4-pgsql php7.4-pspell php7.4-readline php7.4-snmp php7.4-sqlite3 php7.4-tidy php7.4-xml php7.4-xmlrpc libphp7.4-embed php-amqp php-ds php-gearman php-geoip php-gnupg php-http php-igbinary php-lua php-mailparse php-memcache php-memcached php-mongodb php-msgpack php-oauth php-pcov php-pinba php-propro php-psr php-radius php-redis php-rrd php-sass php-solr php-ssh2 php-stomp php-tideways php-uploadprogress php-uuid php-yaml php-zmq php7.4-bcmath php7.4-bz2 php7.4-dba php7.4-enchant php7.4-fpm php7.4-imap php7.4-interbase php7.4-intl php7.4-mbstring php7.4-phpdbg php7.4-soap php7.4-sybase php7.4-xsl php7.4-zip php-raphf php-xdebug php7.4-amqp php7.4-ast php7.4-decimal php7.4-ds php7.4-facedetect php7.4-gearman php7.4-geoip php7.4-gnupg php7.4-grpc php7.4-http php7.4-igbinary php7.4-inotify php7.4-lua php7.4-lz4 php7.4-mailparse php7.4-maxminddb php7.4-mcrypt php7.4-memcache php7.4-memcached php7.4-mongodb php7.4-msgpack php7.4-oauth php7.4-pcov php7.4-phalcon4 php7.4-pinba php7.4-propro php7.4-protobuf php7.4-ps php7.4-psr php7.4-radius php7.4-raphf php7.4-redis php7.4-rrd php7.4-smbclient php7.4-solr php7.4-ssh2 php7.4-stomp php7.4-swoole php7.4-tideways php7.4-uopz php7.4-uploadprogress php7.4-uuid php7.4-vips php7.4-xdebug php7.4-xhprof php7.4-yac php7.4-yaml php7.4-zmq php7.4-zstd