close

How To completely uninstall PHP in ubuntu?

Hello Guy How are you all? Hope You all are fine. Today in this tutorial we are going to learn about How To completely uninstall PHP in ubuntu? In this tutorial, We will Discuss all possible methods to uninstall PHP from the ubuntu server. So Let’s start this article without wasting your time.

How To completely uninstall PHP in ubuntu?

  1. How To completely uninstall PHP in ubuntu?

    To completely uninstall PHP in ubuntu Just Run purge, autoclean and autoremove command in your server, and this command will completely uninstall your PHP from your Ubuntu server. So follow all commands one by one. First Of all, You just need to run the purge command. Just run this command in your terminal: sudo apt-get purge php7.* The above command will Uninstall Any of the PHP 7.X versions of PHP installed on your Server. Now we need to cleans obsolete deb-packages to do so we need to run autoclean command: sudo apt-get autoclean After that, we need to remove orphaned packages that are no longer needed from the system so run autoremove command just like this: sudo apt-get autoremove And Now, You have Successfully Uninstalled PHP from your system. Thank You.

  2. completely uninstall PHP in ubuntu

    To completely uninstall PHP in ubuntu Just Run purge, autoclean and autoremove command in your server, and this command will completely uninstall your PHP from your Ubuntu server. So follow all commands one by one. First Of all, You just need to run the purge command. Just run this command in your terminal: sudo apt-get purge php7.* The above command will Uninstall Any of the PHP 7.X versions of PHP installed on your Server. Now we need to cleans obsolete deb-packages to do so we need to run autoclean command: sudo apt-get autoclean After that, we need to remove orphaned packages that are no longer needed from the system so run autoremove command just like this: sudo apt-get autoremove And Now, You have Successfully Uninstalled PHP from your system. Thank You.

Solution 1: Run this command

To completely uninstall PHP in ubuntu Just Run purge, autoclean and autoremove command in your server, and this command will completely uninstall your PHP from your Ubuntu server. So follow all commands one by one.

First Of all, You just need to run the purge command. Just run this command in your terminal.

sudo apt-get purge php7.*

The above command will Uninstall Any of the PHP 7.X versions of PHP installed on your Server. Now we need to cleans obsolete deb-packages to do so we need to run autoclean command.

sudo apt-get autoclean

After that, we need to remove orphaned packages that are no longer needed from the system so run autoremove command just like this.

sudo apt-get autoremove

You can run this all command together

sudo apt-get purge php7.*
sudo apt-get autoclean
sudo apt-get autoremove

And Now, You have Successfully Uninstalled PHP from your system. Thank You.

Solution 2: Follow this command

You Can use this all command to remove PHP from your system.

sudo apt-get purge `dpkg -l | grep php7.2| awk '{print $2}' |tr "\n" " "`
sudo apt-get purge php7.*
sudo apt-get autoremove --purge
whereis php
sudo rm -rf /etc/php

Above all Command will completely remove PHP from your system. Thanks.

Conclusion

It’s all About this error. I hope We Have solved Your error. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Leave a Comment