H2S Forum

How to uninstall php from Ubuntu

If you want to uninstall PHP from your Ubuntu Linux system then simply type:

sudo apt remove ^php

The above command will select all php packages and ask you to type Y and press Enter to start the removing of PHP from Ubuntu. However, it is recommended rather going for the only php select the PHP version in the above command.

Let’s say you want to remove php5.2 or php 7.2

so the command will be like this:

sudo apt remove php7.2


sudo apt remove php5.2

This would be much better.