Issue to install PHP 5.6 with ppa:ondrej Ubuntu 18.04

2k Views Asked by At

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

2

There are 2 best solutions below

0
felipe On BEST ANSWER

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.

0
Afnan Ngathour Rahman On

Same here, using ubuntu 18.04, cannot install php5.6:

sudo apt install -y php5.6
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'php5.6-json' for regex 'php5.6'
Note, selecting 'php5.6-common' for regex 'php5.6'
0 upgraded, 0 newly installed, 0 to remove and 284 not upgraded.


sudo apt list | grep php5

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

php-symfony-polyfill-php54/bionic 1.6.0-2 all
php-symfony-polyfill-php55/bionic 1.6.0-2 all
php-symfony-polyfill-php56/bionic 1.6.0-2 all

Edited

I just read from GitHub oerdnj/deb.sury.org, ppa:ondrej for Ubuntu 18.04 Bionic End of Standard Support. https://github.com/oerdnj/deb.sury.org/issues/1922