. Advertisement .
..3..
. Advertisement .
..4..
The most recent stable version of PHP is 7.4. The last version before PHP 8 was issued on November 28, 2019. It adds and fixes a lot of new features to the syntax. The error: “Unable to locate package php7.4” is a common error that can show up in many ways. In this blog, we will go through some of the ways you can fix this issue. Read on.
When Do You Encounter The Error: “Unable to locate package php7.4”?
When attempting to install php on your Ubuntu 16.04 server for Apache2, then you run the php -v command, you might get the following error.
Reading package lists… Done
Building dependency tree
Reading state information… Done
Unable to locate package php7.4
Couldn’t find any package by glob ‘php7.4’
Couldn’t find any package by regex ‘php7.4’
How To Solve The Error: “Unable to locate package php7.4”?
Approach 1: Utilize the following repo
The first solution for you to resolve the error “Unable to locate package php7.4” is utilizing the following repo:
sudo add-apt-repository ppa:tomvlk/php-archive
sudo apt-get update
After you do that, your error will be completely resolved. Although it is a simple method, it works flawlessly. Let’s do it to get your desired results.
Approach 2: Utilize a third party repository to install php
PHP is an open source programming language that is mostly employed for server-side (backend) scripting and web development. In easy terms:
- On a server, PHP can be set up to execute scripts (such as the pieces of code to include forms to your site).
- It operates in the backend instead of the browser because it is server-side instead of client-side coded.
- It works well with HTML, so it is a great choice for web development.
It’s a well-liked option for newbies because it’s also among the simplest web programming languages to learn. However, it’s also highly capable and appropriate for sophisticated website features.
If you’re using Ondrej PPA to install PHP, it only works with Ubuntu 21.04, 20.04, 20.10, and 18.04. You’re utilizing an outdated version of Ubuntu, 16.04. So, the long-term solution is to simply upgrade Ubuntu from 18.04 to 21.04. You can archive this for the time being by adding this 3rd party repository to the system. Simply execute these two commands:
sudo add-apt-repository ppa:jczaplicki/xenial-php74-temp
sudo apt-get update
Run the php -v command now. Your problem should be resolved.
Conclusion
We hope you enjoyed our article about the error. With this knowledge, we know that you can fix your error: “Unable to locate package php7.4” quickly by following these steps! If you still have any other questions about fixing this syntax error, please leave a comment below. Thank you for reading!
Read more
→ Tips On Solving The Error: “Unable to install PHP 7.4 on ubantu 16.04 in apache”
Leave a comment