Missing modules bcmath and gmp on security scan-- but these modules are present

Hey long time nextcloud user here but kind of stumped.

I’ve just upgraded to NC 19.0.0 on a freenas freebsd jail installed with php7.4. I’m using nginx as the webserver. Php version is as follows:

$ php --version
PHP 7.4.7 (cli) (built: Jun 16 2020 01:17:04) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.7, Copyright (c), by Zend Technologies

The webupdater failed to update everything but I was able to finish the update process through using the command line occ commands

After upgrading I was able to log in and reviewed the security and setup warnings. I’m getting now a number of new warnings that weren’t present with 18.0.3.

It states I’m missing the following:

This instance is missing some recommended PHP modules. For improved performance and better compatibility it is highly recommended to install them.

bcmath
gmp

I went ahead and installed the php74-bcmath and php74-gmp modules and restarted nginx – but I’m still receiving this message about the missing modules.

I looked in the logs and all I see is this:

[PHP] Error: Trying to access array offset on value of type null at /usr/local/www/nextcloud/apps-pkg/logreader/lib/Log/LogIterator.php#78

GET /index.php/apps/logreader/get?offset=0&count=50&levels=00111
from 192.168.8.2 by ncadmin at 2020-07-06T20:27:56+00:00

Any suggestions? Do I need different modules?

$ pkg info php74-gmp
php74-gmp-7.4.7
Name : php74-gmp
Version : 7.4.7
Installed on : Mon Jul 6 15:19:39 2020 CDT
Origin : math/php74-gmp
Architecture : FreeBSD:11:amd64
Prefix : /usr/local
Categories : math
Licenses : PHP301
Maintainer : tz@FreeBSD.org
WWW : https://www.php.net/
Comment : The gmp shared extension for php
Shared Libs required:
libgmp.so.10
Annotations :
FreeBSD_version: 1103000
cpe : cpe:2.3:a:php:php:7.4.7:::::freebsd11:x64
repo_type : binary
repository : FreeBSD
Flat size : 65.3KiB
Description :
PHP, which stands for “PHP: Hypertext Preprocessor” is a widely-used Open
Source general-purpose scripting language that is especially suited for
Web development and can be embedded into HTML. Its syntax draws upon C,
Java, and Perl, and is easy to learn. The main goal of the language is to
allow web developers to write dynamically generated webpages quickly, but
you can do much more with PHP.

WWW: https://www.php.net/

$ pkg info php74-bcmath
php74-bcmath-7.4.7
Name : php74-bcmath
Version : 7.4.7
Installed on : Mon Jul 6 15:19:14 2020 CDT
Origin : math/php74-bcmath
Architecture : FreeBSD:11:amd64
Prefix : /usr/local
Categories : math
Licenses : PHP301
Maintainer : tz@FreeBSD.org
WWW : https://www.php.net/
Comment : The bcmath shared extension for php
Annotations :
FreeBSD_version: 1103000
cpe : cpe:2.3:a:php:php:7.4.7:::::freebsd11:x64
repo_type : binary
repository : FreeBSD
Flat size : 49.5KiB
Description :
PHP, which stands for “PHP: Hypertext Preprocessor” is a widely-used Open
Source general-purpose scripting language that is especially suited for
Web development and can be embedded into HTML. Its syntax draws upon C,
Java, and Perl, and is easy to learn. The main goal of the language is to
allow web developers to write dynamically generated webpages quickly, but
you can do much more with PHP.

WWW: https://www.php.net/

Here are the installed php modules listed at command line:

$ php -m
[PHP Modules]
apcu
bcmath
bz2
Core
ctype
curl
date
dom
exif
fileinfo
filter
gd
gmp
hash
iconv
imagick
intl
json
ldap
libxml
mbstring
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
redis
Reflection
session
SimpleXML
SPL
standard
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache
2 Likes

Hi @kevdog

sorry to be pedantic: you only write that you restarted nginx - but to get the new modules loaded you actually need to restart php7.4-fpm. Did you do that?

Best Regards,
/S

HI @simonspa

I did not restart php-fpm. I can try that – (I don’t know a lot about php-fpm tbh).

php-fpm is the process that runs your PHP for requests from nginx. without restarting that the modules are not loaded.

I have the same problem, but different setup:

ubuntu 16.04, Apache2, PHP 7.4.9 (cli) (built: Aug 7 2020 14:29:10) ( NTS )

php -m shows both bcmath and gmp, but the security and setup warnings say:

This instance is missing some recommended PHP modules. For improved performance and better compatibility it is highly recommended to install them.

bcmath
gmp

does anyone have an idea how to get it to work, because I like to use the passwordless login for my users.

THX

You’ve most likely answered the question on your own. php -m only shows that the mentioned modules are loaded for the PHP cli component, but what about the PHP web component?!
If you’re running a web based test it usually relies on the web component and not the cli component.

To check which PHP modules have been loaded for the PHP web component, create a php file which contains this line of code and open it using a web browser:

<?php phpinfo() ?>

As I’m facing the same problem after upgrading to v20, I found this topic and your answer.
Sounds pretty logical, but does not explain how it can be solved.
I do have the needed modules installed but how can I pass them to the “php web component”?

Make sure that you’re activating the modules by creating php module configuration files in the right sub directory, e.g. /etc/php7/... Due to the fact that the directory can differ depending on the used distribution and you didn’t provide any information about your environment, I recommend to use the search function of this forum to find an answer or to ask aunt G. for help.

https://help.nextcloud.com/search?q=install%20php%20module

Thank you for your hints,
Even if the once with Uncle G and forum search wasn’t helpful at all.
But the one with the config files in the php directory was.

Could you pass on how you fixed it please? I also have the same problem

1 Like

that helped me. Linuxmint 19.3, Apache, Nextcloud 20.0.5
sudo apt install php7.3-bcmath
sudo apt install php7.3-gmp
sudo service php7.3-fpm restart

3 Likes

@vant this worked for me on raspberrypi4 setup using Nextcloud 20.0.7
Thanks! I left the imagick warning as from reading others are saying its got vulnerabilities and is likely to be removed in the next major release of NC.

Thanks again.