PHP-FPM error after latest update

The “Additional PHP-FPM pool options” section is empty for me.

It is set to “FCGI” by default.

Yeah because I wanted different settings from default, but I just tested and its not following the template settings, maybe a bug. Long time since I played in here. testing server keeps getting these settings

image

Indeed, I noticed that the log was enabled by default with “Default (logs/php_log)”, and the command:

virtualmin modify-web --domain thedomain.com --php-version 8.3

disabled it.

If I had used the “Save” button, it would have left the log disabled by default as well.

Regarding CGI being selected by default, I was mistaken. It is actually set to “FCGI” by default.

That was subserver (maybe why different numbers), I created server and it followed template.
Ahh, there a subserver template, that was empty.

The thing that would need to be done for 80 virtual servers/sub-servers would be to use the following method:

  1. Create 4 folders on my computer’s desktop:
    backup/php7.4
    backup/php8.2
    backup/php8.3
    backup/php8.4

Inside them, save all the configuration files coming from, for example:
/etc/php/8.3/fpm/pool.d/1715975598193946.conf

  1. Then, retrieve each domain name from each configuration file and use the following command:

virtualmin modify-web --domain thedomain.com --php-version [PHP VERSION AFTER /etc/php/]

  1. Then, on the computer desktop, go to the correct folder and upload everything through Webmin > File Manager, replacing all the files for all PHP versions without making any mistakes.

It would be a huge amount of work :o
It would take an entire day to do all of this.

each server has a different number, I would never touch that, thats generated by virtualmin

They aren’t dangerous; for the most part, they haven’t been modified or deleted since 2023.

You can edit a file manually, for example:

pm.max_children = 24

and change it to something else, like “16”.

It seems to stay at 16 permanently, except in the case of a bug like the one in July 2026 :confused:

Right, good luck, gotta go, need to make some money with real job :slight_smile:

Maybe ai can edit them for you :slight_smile:

Is it possible to run the virtualmin modify-web command in bulk using this Bash script?

#!/bin/bash
echo "=== Real PHP Versions of Virtualmin Domains ==="
echo "------------------------------------------------"

virtualmin list-domains --name-only | while read -r d; do
    # Get domain ID (first ID in the output)
    domain_id=$(virtualmin list-domains --domain "$d" --multiline 2>/dev/null | grep -m1 "ID:" | awk '{print $NF}')
    
    # PHP version according to Virtualmin
    php_vmin=$(virtualmin list-domains --domain "$d" --multiline 2>/dev/null | grep "PHP version:" | awk '{print $NF}')
    
    # Detect real FPM pool file using domain ID
    pool_file=$(find /etc/php/*/fpm/pool.d/ -name "${domain_id}.conf" 2>/dev/null | head -n1)
    
    if [ -n "$pool_file" ]; then
        real_version=$(echo "$pool_file" | grep -oE '/php/[0-9.]+' | cut -d'/' -f3)
        mode="FPM"

        # === SAFE UPDATE ? ===
        if [ -n "$real_version" ] && [[ "$real_version" =~ ^[0-9]+\.[0-9]+ ]]; then
            if [ "$real_version" != "$php_vmin" ]; then
                echo "   → Updating $d to PHP $real_version"
                # DISABLED FOR THE MOMENT - Is this correct?
                # xxvirtualmin modify-web --domain "$d" --php-version "$real_version"
            fi
        fi
    else
        real_version="${php_vmin:-?}"
        mode="Other (CGI/FCGI or not FPM)"
    fi

    if [ -n "$php_vmin" ]; then
        printf "%-45s → %-8s (%s)\n" "$d" "$real_version" "$mode"
    else
        printf "%-45s → No website / PHP disabled\n" "$d"
    fi
done

echo "------------------------------------------------"
echo "Done!"

Is the command here correct?

virtualmin modify-web --domain “$d” --php-version “$real_version”

Can I run this Bash script in root ?

Before running it, I’m going to back up all the configuration files in:
/etc/php/[ALL_PHP_versions]/fpm/pool.d/*.conf

I have to retrieve the PHP version from the /etc/php/{php_version}/ path because virtualmin list-domains returns incorrect versions in PHP version:

I have updated the Bash script:

#!/bin/bash
echo "=== Real PHP Versions of Virtualmin Domains ==="
echo "------------------------------------------------"

virtualmin list-domains --name-only | while read -r d; do
    # Get domain ID (first ID in the output)
    domain_id=$(virtualmin list-domains --domain "$d" --multiline 2>/dev/null | grep -m1 "ID:" | awk '{print $NF}')
    
    # PHP version according to Virtualmin
    php_vmin=$(virtualmin list-domains --domain "$d" --multiline 2>/dev/null | grep "PHP version:" | awk '{print $NF}')

    # Type server (server or Sub-server)
    domain_type=$(virtualmin list-domains --domain "$d" --multiline 2>/dev/null | grep -m1 "Type:" | awk '{print $NF}')

    # Home directory:
    home_directory=$(virtualmin list-domains --domain "$d" --multiline 2>/dev/null | grep -m1 "Home directory:" | awk '{print $NF}')
    
    # Detect real FPM pool file using domain ID
    pool_file=$(find /etc/php/*/fpm/pool.d/ -name "${domain_id}.conf" 2>/dev/null | head -n1)
    
    if [ -n "$pool_file" ]; then
        real_version=$(echo "$pool_file" | grep -oE '/php/[0-9.]+' | cut -d'/' -f3)
        mode="FPM"
    else
        real_version="${php_vmin:-?}"
        mode="Other (CGI/FCGI or not FPM)"
    fi

    # === SAFE UPDATE ? ===
    if [ -n "$real_version" ] && [[ "$real_version" =~ ^[0-9]+\.[0-9]+ ]] && [ "$real_version" != "$php_vmin" ]; then
        if [ "$domain_type" = "server" ]; then
            echo "   → Updating $d to PHP $real_version - Type domain: server - $home_directory/logs/php_log"
            # DISABLED - Is this correct?
            # yyvirtualmin modify-web --domain "$d" --php-version "$real_version" --error-log "$home_directory/logs/php_log"
        elif [ "$domain_type" = "Sub-server" ]; then
            echo "   → Updating $d to PHP $real_version - Type domain: Sub-server - $home_directory/logs/php_log"
            # DISABLED - Is this correct?
            # yyvirtualmin modify-web --domain "$d" --php-version "$real_version" --error-log "$home_directory/logs/php_log"
        fi
    fi

    if [ -n "$php_vmin" ]; then
        printf "%-45s → %-8s (%s)\n" "$d" "$real_version" "$mode"
    else
        printf "%-45s → No website / PHP disabled\n" "$d"
    fi
done

echo "------------------------------------------------"
echo "Done!"

Is it safe to run this in bulk?

I updated the Bash script and ran it on a single domain. It seems to be working :

#!/bin/bash
echo "=== Real PHP Versions of Virtualmin Domains ==="
echo "------------------------------------------------"

virtualmin list-domains --name-only | while read -r d; do
    # a single domain for testing
    if [ "$d" = "site.com" ]; then
        # Get domain ID (first ID in the output)
        domain_id=$(virtualmin list-domains --domain "$d" --multiline 2>/dev/null | grep -m1 "ID:" | awk '{print $NF}')
        
        # PHP version according to Virtualmin
        php_vmin=$(virtualmin list-domains --domain "$d" --multiline 2>/dev/null | grep "PHP version:" | awk '{print $NF}')
        
        # Detect real FPM pool file using domain ID
        pool_file=$(find /etc/php/*/fpm/pool.d/ -name "${domain_id}.conf" 2>/dev/null | head -n1)
        
        if [ -n "$pool_file" ]; then
            real_version=$(echo "$pool_file" | grep -oE '/php/[0-9.]+' | cut -d'/' -f3)
            mode="FPM"
        else
            real_version="${php_vmin:-?}"
            mode="Other (CGI/FCGI or not FPM)"
        fi

        # === SAFE UPDATE ? ===
        if [ -n "$real_version" ] && [[ "$real_version" =~ ^[0-9]+\.[0-9]+ ]] && [ "$real_version" != "$php_vmin" ]; then
            conf_copy="/etc/php/${real_version}/fpm/pool.d/${domain_id}.conf"

            if [ -f "$conf_copy" ]; then
                cp "$conf_copy" "${conf_copy}-test"
            else
                echo "   → WARNING: missing PHP-FPM pool: $conf_copy"
            fi

            echo "   → Updating $d to PHP $real_version"
            # DISABLED - Is this correct?
            virtualmin modify-web --domain "$d" --php-version "$real_version"

            conf_paste="/etc/php/${real_version}/fpm/pool.d/${domain_id}.conf-test"
            conf_orig="/etc/php/${real_version}/fpm/pool.d/${domain_id}.conf"

            if [ -f "$conf_paste" ]; then
                mv "$conf_paste" "$conf_orig"
                echo "   → PHP-FPM pool restored: $conf_orig"
            else
                echo "   → WARNING: missing PHP-FPM test pool: $conf_paste"
            fi
        fi

        if [ -n "$php_vmin" ]; then
            printf "%-45s → %-8s (%s)\n" "$d" "$real_version" "$mode"
        else
            printf "%-45s → No website / PHP disabled\n" "$d"
        fi
    fi
done

echo "------------------------------------------------"
echo "Done!"

So, the code to run for all domains would be this ? :

#!/bin/bash
echo "=== Real PHP Versions of Virtualmin Domains ==="
echo "------------------------------------------------"

virtualmin list-domains --name-only | while read -r d; do
    # Get domain ID (first ID in the output)
    domain_id=$(virtualmin list-domains --domain "$d" --multiline 2>/dev/null | grep -m1 "ID:" | awk '{print $NF}')
    
    # PHP version according to Virtualmin
    php_vmin=$(virtualmin list-domains --domain "$d" --multiline 2>/dev/null | grep "PHP version:" | awk '{print $NF}')
    
    # Detect real FPM pool file using domain ID
    pool_file=$(find /etc/php/*/fpm/pool.d/ -name "${domain_id}.conf" 2>/dev/null | head -n1)
    
    if [ -n "$pool_file" ]; then
        real_version=$(echo "$pool_file" | grep -oE '/php/[0-9.]+' | cut -d'/' -f3)
        mode="FPM"
    else
        real_version="${php_vmin:-?}"
        mode="Other (CGI/FCGI or not FPM)"
    fi

    # === SAFE UPDATE ? ===
    if [ -n "$real_version" ] && [[ "$real_version" =~ ^[0-9]+\.[0-9]+ ]] && [ "$real_version" != "$php_vmin" ]; then
        conf_copy="/etc/php/${real_version}/fpm/pool.d/${domain_id}.conf"

        if [ -f "$conf_copy" ]; then
            cp "$conf_copy" "${conf_copy}-test"
        else
            echo "   → WARNING: missing PHP-FPM pool: $conf_copy"
        fi

        echo "   → Updating $d to PHP $real_version"
        # DISABLED - Is this correct?
        # yyvirtualmin modify-web --domain "$d" --php-version "$real_version"

        conf_paste="/etc/php/${real_version}/fpm/pool.d/${domain_id}.conf-test"
        conf_orig="/etc/php/${real_version}/fpm/pool.d/${domain_id}.conf"

        if [ -f "$conf_paste" ]; then
            mv "$conf_paste" "$conf_orig"
            echo "   → PHP-FPM pool restored: $conf_orig"
        else
            echo "   → WARNING: missing PHP-FPM test pool: $conf_paste"
        fi
    fi

    if [ -n "$php_vmin" ]; then
        printf "%-45s → %-8s (%s)\n" "$d" "$real_version" "$mode"
    else
        printf "%-45s → No website / PHP disabled\n" "$d"
    fi
done

echo "------------------------------------------------"
echo "Done!"

and:

sudo service php*-fpm restart

I ran the script 45 minutes ago, and everything went well. Here is the code I used:

#!/bin/bash
echo "=== Real PHP Versions of Virtualmin Domains ==="
echo "------------------------------------------------"

virtualmin list-domains --name-only | while read -r d; do
    echo "------ Début pour $d"
    # Get domain ID (first ID in the output)
    domain_id=$(virtualmin list-domains --domain "$d" --multiline 2>/dev/null | grep -m1 "ID:" | awk '{print $NF}')
    
    # PHP version according to Virtualmin
    php_vmin=$(virtualmin list-domains --domain "$d" --multiline 2>/dev/null | grep "PHP version:" | awk '{print $NF}')
    
    # Detect real FPM pool file using domain ID
    pool_file=$(find /etc/php/*/fpm/pool.d/ -name "${domain_id}.conf" 2>/dev/null | head -n1)
    
    if [ -n "$pool_file" ]; then
        real_version=$(echo "$pool_file" | grep -oE '/php/[0-9.]+' | cut -d'/' -f3)
        mode="FPM"
    else
        real_version="${php_vmin:-?}"
        mode="Other (CGI/FCGI or not FPM)"
    fi

    # === SAFE UPDATE ? ===
    if [ -n "$real_version" ] && [[ "$real_version" =~ ^[0-9]+\.[0-9]+ ]] && [ "$real_version" != "$php_vmin" ]; then
        conf_orig="/etc/php/${real_version}/fpm/pool.d/${domain_id}.conf"

        if [ -f "$conf_orig" ]; then
            cp "$conf_orig" "${conf_orig}-test"
            echo "cp "$conf_orig" "${conf_orig}-test""
        else
            echo "   → WARNING: missing PHP-FPM pool: $conf_orig"
        fi

        echo "   → Updating $d to PHP $real_version"
        # DISABLED - Is this correct?
        virtualmin modify-web --domain "$d" --php-version "$real_version"

        conf_paste="/etc/php/${real_version}/fpm/pool.d/${domain_id}.conf-test"

        if [ -f "$conf_paste" ]; then
            mv "$conf_paste" "$conf_orig"
            echo "mv "$conf_paste" "$conf_orig""
            echo "   → PHP-FPM pool restored: $conf_orig"
        else
            echo "   → WARNING: missing PHP-FPM test pool: $conf_paste"
        fi
    fi

    if [ -n "$php_vmin" ]; then
        printf "%-45s → %-8s (%s)\n" "$d" "$real_version" "$mode"
    else
        printf "%-45s → No website / PHP disabled\n" "$d"
    fi

    echo "------ Fin"
done

echo "------------------------------------------------"
echo "Done!"

I checked the “PHP Options” of all the servers, and everything looks fine for now, I would say.

I think I understand the root cause of the issue now. See this comment:

How should I apply the patch?
Yesterday, I ran the Bash script. Will it destroy anything related to the patch?

You shouldn’t apply this patch.

Will everything work in the next version of Virtualmin ?

Not if it’s already been broken. In this case, you’d need to use Virtualmin UI or CLI to fix this issue.

Likely the more simple solution to the problem would be:

virtualmin modify-web --all-domains --mode none
virtualmin modify-web --all-domains --mode fpm

Ah ok

--all-domains --mode fpm

Not for all domains. Some of them are disabled, and others are not using FPM.

That’s why I preferred to use the Bash script.