Install the PHP 8.1 Modules or Extensions of 'GMP' and 'BC Math' for NextCloud 27 Requirements on Ubuntu Server 24.02
NextCloud 27 Administration Overview Page may alert you to the following:
The PHP modules “gmp” and/or “bcmath” are not enabled. If you use WebAuthn passwordless authentication, these modules are required.
If these modules are configured, users can elect use WebAuthn passwordless authentication (presumably to log into NextCloud). If you want to enable these modules/extensions (GMP and BC Math) then,
If your NextCloud instance is installed on Ubuntu 22.04 with PHP 8.1, then run this command to install the correct php version of gmp and bcmath:
$ sudo apt install php8.1-gmp php8.1-bcmath
Reading package lists... Done Building dependency tree... Done Reading state information... Done The following NEW packages will be installed: php8.1-bcmath php8.1-gmp 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Need to get 39.1 kB of archives. After this operation, 172 kB of additional disk space will be used. Get:1 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 php8.1-bcmath amd64 8.1.2-1ubuntu2.11 [16.5 kB] Get:2 http://us.archive.ubuntu.com/ubuntu jammy-updates/main amd64 php8.1-gmp amd64 8.1.2-1ubuntu2.11 [22.6 kB] Fetched 39.1 kB in 1s (58.9 kB/s) Selecting previously unselected package php8.1-bcmath. (Reading database ... 83916 files and directories currently installed.) Preparing to unpack .../php8.1-bcmath_8.1.2-1ubuntu2.11_amd64.deb ... Unpacking php8.1-bcmath (8.1.2-1ubuntu2.11) ... Selecting previously unselected package php8.1-gmp. Preparing to unpack .../php8.1-gmp_8.1.2-1ubuntu2.11_amd64.deb ... Unpacking php8.1-gmp (8.1.2-1ubuntu2.11) ... Setting up php8.1-bcmath (8.1.2-1ubuntu2.11) ... Creating config file /etc/php/8.1/mods-available/bcmath.ini with new version Setting up php8.1-gmp (8.1.2-1ubuntu2.11) ... Creating config file /etc/php/8.1/mods-available/gmp.ini with new version Processing triggers for libapache2-mod-php8.1 (8.1.2-1ubuntu2.11) ... Processing triggers for php8.1-cli (8.1.2-1ubuntu2.11) ... Scanning processes... Scanning processor microcode... Scanning linux images... Running kernel seems to be up-to-date. The processor microcode seems to be up-to-date. No services need to be restarted. No containers need to be restarted. No user sessions are running outdated binaries. No VM guests are running outdated hypervisor (qemu) binaries on this host.
Run the following command to check for a complete list of all PHP Modules that are installed and available to be enabled by apache2 restart. Note that this option -m, however, may not indicate which modules are actually enabled (such as upon the next restart of Apache2).
Now restart Apache2 webserver to ensure these PHP changes are actually enabled. This was necessary after installing the gmp and bcmath modules because I checked the NextCloud Administration Overview page and the alert message was still there stating, “The PHP modules “gmp” and/or “bcmath” are not enabled . . etc.”
sudo systemctl restart apache2