How to install & uninstall PHP 8.1 in Ubuntu

About PHP

PHP stands for Hypertext preprocessor, and it’s a script-based server side programing language. Using PHP we can show our data conditional based.

Installing PHP

The following command installs PHP using the apt package manager:

sudo apt install php8.1

Verify the installation

Using terminal we can verify PHP is installed or not. Just type this command on terminal

php -v

It’s showing the PHP version and PHP copyrights details. If that details not show it means PHP is not installed in your system.

Installing PHP modules

Mostly all the php module we can install using php<version>-<module_name>


sudo apt install php8.1-gd

gd is one of the PHP module. We can install other modules with same syntax as per above.

Uninstall PHP module

Using this command you can uninstall any of the php module

sudo apt purge php8.1-gd
sudo apt autoremove
sudo apt autoclean
sudo apt update

This command remove PHP gd module. If you want to remove other module then just change the module name instead gd module.

Uninstall PHP

Using this command you can uninstall PHP.

sudo apt purge php8.1
sudo apt autoremove
sudo apt autoclean
sudo apt update

That’s all for install and remove PHP in ubuntu.

Fill free to ask me any of the Magento issues or contact me if your need any customisation or other Magento related service.

Will provide you these Magento services click here for more details

Leave your comment

Your email address will not be published. Required fields are marked *