. Advertisement .
..3..
. Advertisement .
..4..
Ubuntu is a widespread Linux distribution created by Canonical. It is a free and open-source Linux operation system that functions as an alternative to operating systems like Windows and macOS. Now you want to remove PHP 7.4 in ubuntu from your server. This article will provide you with the methods to help you completely uninstall PHP 7.4 in ubuntu.
How To Completely Uninstall PHP 7.4 in ubuntu?
Uninstalling PHP 7.4 may not be very difficult, but some files might remain when you try to uninstall the scripting language. There are two solutions to remove PHP 7.4 in ubuntu entirely. Get on reading to see if you want to use which one of these.
METHOD 1: Run The Following Command
The first easy step to uninstall everything of PHP 7.4 from ubuntu is to run the combined command we show you below.
sudo apt-get purge `dpkg -l | grep php7.4| awk '{print $2}' |tr "\n" " "`
sudo apt-get purge php7.4
sudo apt-get autoremove --purge
whereis php
sudo rm -rf /etc/php
As a result, you should see your terminal runs lots of removing PHP and packages.
And you can check if you have deleted whole packages of PHP 7.4 by the following command.
composer --version
You also can try the second solution in the next part of this article.
METHOD 2: Use Purge, Autoclean, Autoremove Command
To uninstall PHP 7.4, you also need to remove all of the packages belonging to it. If you use these three commands – purge, autoclean, and autoremove command, on your server, PHP 7.4, including its packages, will completely uninstall in ubuntu. In this method, we will demonstrate in detail these commands. First, you will need to run the purge command as follows.
sudo apt-get purge php7.4
This command will delete every PHP version 7.4 installed on your server.
Now we need to clean deb-packages. Deb-package (Debian Software Package) contains all the necessary files to implement a set of connected commands or features, especially used in Unix-based operating systems, including Ubuntu and iOS. To remove deb-packages, run the autoclean
command.
sudo apt-get autoclean
After that, your server may still contain unnecessary files relating to PHP 7.4. We must delete those orphaned packages from the system that are no longer needed. Replace autoclean
with autoremove
to execute the command just as below.
sudo apt-get autoremove
We use the single command one by one as above for you to easily understand the syntax and follow it.
Or you can combine those all together as follows.
sudo apt-get purge php7.4
sudo apt-get autoclean
sudo apt-get autoremove
Finally, PHP 7.4 should be entirely removed in ubuntu.
Conclusion
The solutions presented are simple methods to the major issue, How to completely uninstall PHP 7.4 in ubuntu. We believe with this article, you will successfully uninstall PHP 7.4 without trouble. If you have any questions about this problem, please leave a comment below. This community is always eager to help and grow by learning from others.
Read more:
Leave a comment