How to Uninstall PHP, Apache and MySQL on Ubuntu 18.04 LTS

How to Uninstall PHP, Apache and MySQL on Ubuntu 18.04 LTS
How to Uninstall PHP, Apache and MySQL on Ubuntu 18.04 LTS

Hello friends in this tutorial you will know how to uninstall or remove PHP, Apache and MySQL on Ubuntu 18.04 LTS. The step by step commands has been given in this tutorial. So if your are facing any issue I suggest you to please watch the video that is provided below.
Also Read:- How To Install Linux, Apache, MySQL, PHP (LAMP) on Ubuntu

Table of Contents

Prerequisites:-

Need sudo/root priviledges


First we remove PHP from Ubuntu 18.04 LTS.


sudo apt-get remove –purge php*
sudo apt-get purge php*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get remove dbconfig-php
sudo apt-get dist-upgrade
Warning below command will do completely remove any package with a name that starts with php and anything related to it.


sudo apt-get purge 'php*'
So, DON’T PRESS “y” UNTIL YOU ENSURE that in the removing packages list there are no other packages (besides related to php packages), like:
Suppose if you are removing php7.3 then use the below commands.


sudo apt-get remove –purge php7.3*
sudo apt-get purge php7.3*
whereis php
sudo rm -rf /etc/php
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get remove dbconfig-php
sudo apt-get dist-upgrade

Now we remove Apache2  from Ubuntu.

sudo service apache2 stop
sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
sudo apt-get autoremove

Finally we are removing MySql 5.7 from Ubuntu.

sudo apt-get remove –purge mysql*
sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get remove dbconfig-php
sudo apt-get dist-upgrade

 Removing directories from their respective default locations.

sudo rm -rf /etc/apache2
sudo rm -rf /etc/php
sudo rm -rf /var/lib/mysql
sudo rm etc/mysql


Conclusion

Congratulation you have successfully uninstalled or removed LAMP- PHP, apache2, and MySql from Ubuntu 18.04 LTS. Let me know in the comment box if you are facing any difficulties while executing above commands.

Also Read:- How To Install Linux, Apache, MySQL, PHP (LAMP) on Ubuntu

Also Read:-  How to Install MySQL 8.0 on Ubuntu 16.04 LTS ??

Also Read:- Uninstall or Remove MySql 5.7 from Ubuntu 20.04 LTS.

One comment

Leave a Reply

Your email address will not be published.