How to Uninstall PHP 8.3, 8.2, 8.1, 7.4 on Ubuntu 22.04

How to Uninstall PHP 8.3, 8.2, 8.1, 7.4 on Ubuntu 22.04

If you have multiple PHP versions installed, you might want to remove or uninstall a specific PHP version, like 8.1, 8.2, 8.3, or 7.4 on an Ubuntu 22.04 system.

In this tutorial, we will show you 4 different ways to completely remove different versions of PHP like 8.1, 8.2, 8.3 and 7.4 on Ubuntu 22.04 system.

Here are four different solutions to remove php 8.1, 8.2, 8.3, or 7.4 from ubuntu 22.04:

  • Solution 1: Uninstall PHP 8.1 on Ubuntu
  • Solution 2: Remove PHP 8.2 on Ubuntu
  • Solution 3: Uninstall PHP 8.3 on Ubuntu
  • Solution 4: Completely Remove PHP 7.4 on Ubuntu

Open your terminal or command and check which version you have installed in your Ubuntu. For this you can use this command, this command will show the version of PHP on your terminal:

php -v

Now you can choose the solution according to your PHP version, which will help in removing PHP from your Ubuntu system.

Solution 1: Uninstall PHP 8.1 on Ubuntu

You type these 3 commands together on the terminal and press enter, these 3 commands will completely remove PHP 8.1 version from your ubuntu 22.04 system.

sudo apt remove --purge php8.1
sudo apt remove --purge php8.1-fpm
sudo rm -rf /etc/php/8.1

Solution 2: Remove PHP 8.2 on Ubuntu

It is quite similar to the previous one. In this, you just have to change the PHP version in the command.

You can initiate the removal process of php 8.2 on ubuntu by typing this on terminal:

sudo apt remove --purge php8.2
sudo apt remove --purge php8.2-fpm
sudo rm -rf /etc/php/8.2

Solution 3: Uninstall PHP 8.3 on Ubuntu

To remove PHP 8.3 on Ubuntu 22.4, you can use these commands, sudo apt remove –purge php8.3-fpm and sudo rm -rf /etc/php/8.3

sudo apt remove --purge php8.3
sudo apt remove --purge php8.3-fpm
sudo rm -rf /etc/php/8.3

Solution 4: Completely Remove PHP 7.4 on Ubuntu

Or if you have php 7.4 installed in your Ubuntu system, you have to use these commands, which can help you to easily remove php 7.4 version and its associated packages, libraries, extensions, etc:

sudo apt remove --purge php7.4
sudo apt remove --purge php7.4-fpm
sudo rm -rf /etc/php/7.4

Conclusion

Uninstalling PHP 8.x and 7.x versions on Ubuntu 22.04 is a straightforward process that involves using the Terminal app to remove the PHP executable and configuration files.

Recommended Tutorials

AuthorAdmin

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

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