Previously we talked about one indispensable plugin WP Statistics. WordPress WP statistics like plugins use the module with GEO IP and infamously through errors rendering plugin’s many functions limited. Here is how to fix PHP bcmath extension missing on Ubuntu 16.04, Nginx running PHP 7.0 or PHP 7.1. Ofcouse one can follow this guide to fix PHP bcmath extension missing Ubuntu 16.04 for any type of web softwares.
Fix : PHP bcmath Extension Missing Ubuntu 16.04 : Stepwise Troubleshoot
If you have upgraded from old Nginx and PHP, then you must check which version of PHP you are actually using. If we run php -v
command we will get this kind of output :
1 2 3 4 5 | root@server:/home/user# php -v PHP 7.1.5-1+deb.sury.org~xenial+1 (cli) (built: May 11 2017 14:07:52) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.1.5-1+deb.sury.org~xenial+1, Copyright (c) 1999-2017, by Zend Technologies |
The above output is saying that maximum version of PHP the system can use is 7.1.5. It does not mean really it is using PHP 7.0. That way deliberately set by the repo maintainer for backward compatibility. If you change directory to /etc/php/
and do and ls
, you’ll see all the versions :
---
1 2 3 | root@server:/home/user# cd /etc/php/ root@server:/etc/php# ls 5.5 5.6 7.0 7.1 |
From Nginx, actually you can use any of the version of PHP.
Secondly, you should check which repo you are using by looking at these files and directories :
1 2 3 4 5 | cat /etc/apt/sources.list cd /etc/apt ls cd sources.list.d ls |
In our case, the ls
output is :
1 2 | goaccess.list ondrej-ubuntu-php-xenial.list nginx-ubuntu-development-xenial.list percona.list |
We wanted to see whether ondrej-ubuntu-php-xenial.list
is present or not. In case you do not that PPA in your system, simply run these commands :
1 2 3 | apt-get install -y python-software-properties sudo add-apt-repository -y ppa:ondrej/php apt update |
Now, if you go to /etc/nginx/sites-available
directory and open Nginx “virtual hosts” file, search with fastcgi_pass unix:/run/php/php
(in case you are using UNIX socket), you will find the entries like :
1 2 3 4 | location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/run/php/php7.0-fpm.sock; |
The above is example that you are using php7.0, not php7.1; although both are available on your system. Now, you have two options :
- Using PHP 7.1 and install that missing PHP bcmath
- Continue using PHP 7.0 and install that missing PHP bcmath
We suggest to temporarily continue using PHP 7.0 and install that missing PHP bcmath and later plan to upgrade to PHP 7.1. Because changing version of PHP-FPM with Nginx is not exactly easy smooth work, that needs lot of backup and can have a downtime – expect white pages and troubleshooting.
Simply run :
1 | apt-get install php7.0-bcmath |
You are expected to get installation output :
1 2 3 4 5 6 7 8 | Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: php7.0-bcmath 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 15.6 kB of archives. After this operation, 64.5 kB of additional disk space will be used. |
Continue it and restart the services :
1 2 3 | service php7.0-fpm restart service nginx restart service mysql restart |
Alternatively, in case you want to use PHP 7.1 and install that missing PHP bcmath then run :
1 | apt-get install php7.1-bcmath |
and restart the services :
1 2 3 | service php7.0-fpm restart service nginx restart service mysql restart |
Check your web application, it should be working now. There is no more extra settings, PHP bcmath enabled while compilation for the above PPA. If you still can not make PHP bcmath active, you have some other problem and you should have a basic checking of the log files.
Tagged With php bcmath extension , the requested PHP extension bcmath is missing , php bcmath sur wordpress , PHP bcmath extension missing (PHP configuration parameter --enable-bcmath) , PHP bcmath extension missing , https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1882 w9SycZw1f_L8z_eYuZa7Ffp8-Br0vOlrIYAqWHTD4Lc7XFJAx7agbUk40v6dxUx5 8bd81832be97522904f35502b94ecad020713ce0&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme , https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1835 g5A0l3MMQplU0sXebZZqPOhDQKJCK6nr0c0x-G9FTDYQpvkJeXStnhxyEKBrbLm9 dc09943a880e70babf790ef7b82c339bc10152c9&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme , https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1827 M9Ud68f8vuhofWzKcSZNQJUSU9jP8D2TO8Cah8iU8G_nRJ3Y-pJNsOJ1RQZs423Q 72d6c3e5f4ad775c303ce083f35a572e75118272&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme , https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1827 Bhfh68sahsqg4orlO7a0oWi5eQah0VxmciN3BovYuMTgRrHph38W5P-vU9zGcswR aa34e29c2cf69c24885ea98346d771a4afc7e762&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme , Отсутствует расширение PHP bcmath (параметр конфигурации PHP --enable-bcmath)