How to Safely Disable or Remove Unused PHP Versions Without Breaking CloudPanel?

Nemesis

Active member
Joined
Mar 22, 2025
Messages
36
Points
61
Age
26
I have CloudPanel installed and running on my server, and I noticed that multiple versions of PHP-FPM are installed and running on the system. Specifically, I have PHP versions 7.1, 7.2, 7.3, 7.4, and PHP 8.x versions running simultaneously, but only using 8.3 and 8.4 versions for my projects.
I am concerned about the resource usage of PHP-FPM services for versions that are not in use.
I would like to disable or remove these unused PHP versions to optimize resource usage. However, I want to make sure that I don't accidentally break CloudPanel or any of its core services in the process.
My specific questions are:
Can I safely disable or remove PHP-FPM services for unused PHP versions without affecting CloudPanel's functionality?
If so, what is the recommended approach to ensure I do not disable the PHP version that CloudPanel relies on?
Are there any specific versions of PHP (e.g., PHP 7.1, 7.2) that I should avoid removing, given that CloudPanel may depend on them for system functionality?
What steps should I follow to ensure the safe removal or disabling of PHP versions, and are there any precautions I should take?
I would really appreciate any guidance or best practices on how to proceed safely without causing issues with CloudPanel.
Thank you in advance!

Source: https://github.com/cloudpanel-io/cloudpanel-ce/discussions/642
 
Code:
You can safely disable unused PHP-FPM versions in CloudPanel. Based on my testing, here's the safest approach:

1. Stop and disable the PHP-FPM services, but do not delete or rename the files:

```bash
# For versions you're not using (e.g., PHP 7.1, 7.2, 7.3, 7.4):
systemctl stop php7.1-fpm
systemctl disable php7.1-fpm
# Repeat for other unused versions

For additional resource optimization, you can minimize the pool configurations:

Code:
# For each unused PHP version:
nano /etc/php/7.1/fpm/pool.d/www.conf
# Edit these settings:
pm = ondemand
pm.max_children = 2
pm.process_idle_timeout = 10s

  • CloudPanel depends on PHP files being in specific locations, so deleting/renaming files may cause 500 errors
  • Keep both the files and services for PHP 8.3 and 8.4 since those are your actively used versions
  • Future system updates might re-enable the services you disabled, so check them periodically
 
Back
Top