How To Fix “Unable to install PHP 7.4 on ubantu 16.04 in apache2”?
Are you having problems with the issue “Unable to install PHP 7.4 on ubantu 16.04 in apache2“? How to fix it? In today’s article, I will provide solutions for you to solve the issues. Please follow the below steps to get the problem resolved now
How did “Unable to install PHP 7.4 on ubantu 16.04 in apache2” occur?
Unable to install PHP 7.4 on ubantu 16.04 in apache2
When you work with PHP, you may get the issue Unable to install PHP 7.4 on ubantu 16.04 in apache2. Don’t worry, we are here to provide you solutions in order to resolve your problem.
How to fix “Unable to install PHP 7.4 on ubantu 16.04 in apache2”?
Your Ubuntu version is the problem. Ubuntu 16.04 (Xenial), is actually too old. Ondrej PPA supports only the Hirsute (21.04) and Groovy (20.10) operating systems. Focal (20.04), Bionic (18.04). This is why no package was found. The solution is to roll back to PHP version 7.3. Here’s how to do it.
Solution 1: Rollback to the old PHP version.
Your Ubuntu version is the problem. Ubuntu 16.04 (Xenial), is actually too old. Ondrej PPA supports only the Hirsute (21.04) and Groovy (20.10) operating systems. Focal (20.04), Bionic (18.04). This is why there are no packages found.
You can rollback to the old PHP version 7.3. Here’s a guide to installing PHP 7.3 in Ubuntu.
First, install apache2. To install Apache web server, execute the following command:
apt install apache2
To start Apache2 after installing Apache2, follow the below command:
systemctl start apache2
This command will allow you to check the status of Apache’s web service.
systemctl status apache2
The following command can be used to install PHP 7.3:
apt install php7.3 php7.3-cli php7.3-common
Use the below command to check if PHP 7.3 is installed on your server.
php -v
Solution 2: Use a third-party repository
You can use a third-party repository. Use this command.
sudo add-apt-repository ppa:jczaplicki/xenial-php74-temp
Next, run this command.
sudo apt-get update
Solution 3: Update os at least to 18.04
Ubuntu 16.04 is no longer supported. Only versions of Ubuntu and php are supported by Ondrej PPA. Standard Support for 16.04 expired in April 2021. You probably didn’t get any php7.3 updates since then. To do this, you will need to use update atleast 18.04 you should be fine installing any php version >= 7.3
Final words
The above are useful solutions that can help you fix “Unable to install PHP 7.4 on ubantu 16.04 in apache2” problem, if you can’t solve it well. Please leave a message.