How to remove deprecated PHP versions

Discussion in 'ISPConfig 3 Priority Support' started by Jemt, Jun 16, 2024.

  1. Jemt

    Jemt Member HowtoForge Supporter

    Hi,

    The How to install PHP 5.6 and 7.0 - 8.3 with PHP-FPM and FastCGI mode for ISPConfig 3.2 with apt on Debian 10 to 12 guide has been great at helping us get access to the most recent versions of PHP.

    But how do we get rid of old deprecated versions entirely, to reduce the risk of vulnerabilities being exploited, and to keep the system nice and clean?

    I was wondering if `apt-get remove ...` for all the packages reported by `dpkg --get-selections | grep -i php7.0` would be sufficient to get rid of PHP 7.0 ?
    .. and naturally make sure no websites are configured with PHP 7.0. Will all websites automatically fall back to "Default" if we remove a PHP version from "Additional PHP Versions"? Or do I have to check every single website configured on the server, to figure out which uses PHP 7.0, and then change their configuration manually ?

    upload_2024-6-16_16-58-29.png

    Thanks in advance :)
     
  2. Jemt

    Jemt Member HowtoForge Supporter

    I realize that PHP 7.0 in the specific case is not used by any websites. But PHP 5.6, 7.1, 7.3 are, and I'd like to get rid of almost all versions, probably exception 7.4 (used by Debian 11), 8.2 and 8.3.
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    Change the PHP of the websites that use a specific PHP version so that the version is not used anymore. Then delete the PHP version in ISPConfig and uninstall the PHP version on the system using apt.
     
  4. Jemt

    Jemt Member HowtoForge Supporter

    Thanks @till, I will try that.

    I think we have almost 200 websites, so it's a pain to find the once using specific versions of PHP. For anyone else, this SQL selection will provide an overview of all websites with PHP enabled, that are still active/enabled:

    SELECT wd.domain, wd.system_user, wd.system_group, wd.php, COALESCE(sp.name, "Default") as phpver, wd.ssl, wd.ssl_letsencrypt
    FROM `web_domain` AS wd
    LEFT JOIN server_php AS sp on sp.server_php_id = wd.server_php_id
    WHERE wd.php != 'no' AND wd.active = 'y';

    upload_2024-6-16_19-7-40.png

    Obviously, take care not to make any changes to ISPConfig's database.
     

Share This Page