Monday, December 13, 2021

Install Php older version in ubuntu 16 without error

PHP support for Ubuntu xenial 16.04 has dropped since 2021-06-10. I've found this out the hard way when I also tried installing PHP modules / versions on other VM's that use 16.04 and apparently "couldn't find packages" when other machine had previously installed them with ease.

Post last Updated : 11-July-23

Error Example :-


Tech2towards@-8784:~$ sudo apt install php7.3 libapache2-mod-php7.3
Reading package lists... Done
Building dependency tree       
Reading state information... Done

E: Unable to locate package php7.3
E: Couldn't find any package by glob 'php7.3'
E: Couldn't find any package by regex 'php7.3'
E: Unable to locate package libapache2-mod-php7.3
E: Couldn't find any package by glob 'libapache2-mod-php7.3'
E: Couldn't find any package by regex 'libapache2-mod-php7.3'


Use Following Commands to install Older version of PHP without Error

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

OR

$ sudo apt-get install php7.0



If Still Your Facing Error Then Try Below One

sudo add-apt-repository ppa:jczaplicki/xenial-php73-temp

                          or 

sudo add-apt-repository ppa:jczaplicki/xenial-php74-temp

sudo apt-get update


(7-Dec-23) If Still You are Facing below Error (Then Try tricky solution) its not official but worked for me.

E: Unable to locate package php7.4

Scenario: I was using ubuntu20 in azure after trying all documents and efforts but couldn't install PHP.

Solution: I just replaced /etc/apt/source.list content with fresh ubuntu20 /etc/apt/source.list file content and then It worked :-)
 

No comments:

Post a Comment

testing