ubuntu-18.04php-5.6

Issue to install PHP 5.6 with ppa:ondrej Ubuntu 18.04


Good day:

I am trying to install PHP 5.6 with ppa:ondrej on Ubuntu 18.04 (LTS) x64

One year ago, it worked successfully, using the following commands:

sudo add-apt-repository -y ppa:ondrej/php
sudo aptitude install -y php7.0 php5.6 php5.6-mysql php-gettext php5.6-mbstring php-mbstring php7.0-mbstring php-xdebug libapache2-mod-php5.6 libapache2-mod-php7.0
sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart
sudo update-alternatives --set php /usr/bin/php5.6
  1. What could I'd be doing wrong? How could I fix it?
  2. Do I need to upgrade to Ubuntu 22.04?

Thanks in advance, Felipe


Solution

  • I could install PHP 5.6.40 when I upgrade to Ubuntu 22.04.

    For more details, I modified first this file:

    /etc/needrestart/needrestart.conf
    

    enable this $nrconf{restart} = 'a';

    Then I follow the commands:

    aptitude update
    aptitude install -y php5.6
    php -v
    

    Then it worked successfully.