Current Location: Home> Latest Articles> How to Completely Remove PHP7.0 on Ubuntu

How to Completely Remove PHP7.0 on Ubuntu

gitbox 2025-07-28

Ubuntu, as a popular Linux-based operating system, offers convenient ways to install and upgrade software. If you have PHP7.0 installed but want to completely remove it, this article provides a series of steps to help you thoroughly uninstall PHP7.0.

Remove PHP7.0 Software Packages

To completely remove PHP7.0, you first need to clear all related software packages. Open a terminal and enter the following command:

sudo apt-get remove php7.0*

This command will remove all packages starting with "php7.0" from the system.

Note: Before removing the software packages, ensure that you have backed up all relevant data and recorded any changes made, to avoid the risk of data loss.

Remove PHP7.0 Configuration Files

After removing the software packages, you will need to remove the configuration files related to PHP7.0. Run the following command:

sudo apt-get purge php7.0*

This command will delete all configuration files associated with PHP7.0.

Remove PHP7.0 Dependencies

After removing the software packages and configuration files, there may still be some PHP7.0 dependencies left on your system. You can clean them up by running the following command:

sudo apt-get autoremove

This command will automatically remove libraries that are no longer needed by the system, including PHP7.0 dependencies.

Remove PHP7.0 Installation Directory

Finally, you need to manually delete the PHP7.0 installation directory. Enter the following command:

sudo rm -rf /etc/php/7.0

This command will delete the PHP7.0 installation directory.

Conclusion

This article outlines how to completely remove PHP7.0 from Ubuntu. By removing the software packages, configuration files, dependencies, and installation directories, you can ensure that PHP7.0 is fully uninstalled. Be sure to back up your data and record any changes before proceeding with the removal.