In HestiaCP, you can remove the PHP versions you no longer need, but first check whether any websites are using them. Your service list shows PHP 5.6 through PHP 8.1, and all of their PHP-FPM services currently show 0 minutes uptime.
Important: Removing a PHP version can break websites assigned to it. Also, a service showing 0 minutes does not necessarily mean it is unused.
1. Check which PHP versions your websites use
Connect to your server using SSH as root, then run:
v-list-web-domains adminReplace admin with the relevant HestiaCP username. To inspect a particular domain, run:
bash
v-list-web-domain admin example.comLook for the PHP version assigned to each website before removing anything.
2. Remove unused PHP versions
HestiaCP provides an official command for removing individual PHP-FPM versions. It checks whether a version is installed and whether it is in use by a domain.
For example, to remove PHP 5.6:
/usr/local/hestia/bin/v-delete-web-php 5.6To remove PHP 7.0:
/usr/local/hestia/bin/v-delete-web-php 7.0Repeat for each version you have confirmed is no longer needed:
/usr/local/hestia/bin/v-delete-web-php 7.1
/usr/local/hestia/bin/v-delete-web-php 7.2
/usr/local/hestia/bin/v-delete-web-php 7.3
/usr/local/hestia/bin/v-delete-web-php 7.4
/usr/local/hestia/bin/v-delete-web-php 8.0
/usr/local/hestia/bin/v-delete-web-php 8.1apt-get purge php5.6-* -y
apt-get purge php7.0-* -y
apt-get purge php7.1-* -y
apt-get purge php7.2-* -y
apt-get purge php7.3-* -y
apt-get purge php7.4-* -y
apt-get purge php8.1-* -y
apt-get purge php8.2-* -yDo not run these commands blindly. Keep at least one supported PHP version that your websites and HestiaCP components require. If the command reports an error or that a version is still in use, investigate before proceeding.
3. Verify the result
After removal, run:
bash
/usr/local/hestia/bin/v-list-sys-phpThen check PHP-FPM services:
systemctl --type=service --state=running | grep phpIf you want to remove unused dependencies after reviewing the proposed changes, run:
apt-get autoremoveReview the packages APT proposes to remove before confirming.