Undefined function bandwidthThrottle\tokenBucket\util\bcsub() When bcsub installed on all php versions on the server

403 Views Asked by At

I've got a project on an Ubutu server. I keep getting the following error

\FatalThrowableError: Call to undefined function bandwidthThrottle\tokenBucket\util\bcsub()
in vendor/bandwidth-throttle/token-bucket/classes/util/TokenConverter.php:80


 public function convertMicrotimeToTokens($microtime)
    {
        $delta = bcsub(microtime(true), $microtime, $this->bcScale); // <--- this line
        return $this->convertSecondsToTokens($delta);
    }

The package we're using is the bandwidth-throttle/token-bucket and we're using 2.0

I've made sure that bcmath is installed across each version of php on the server

I Ran the following;

sudo apt-get install php7.1-bcmath
sudo apt-get install php7.2-bcmath
sudo apt-get install php7.3-bcmath
sudo apt-get install php7.4-bcmath

sudo service apache2 restart

When I run "php -r "print_r(get_loaded_extensions());"" I get the following so I know it's there but my project is throwing an error anyway

Array
(
    [0] => Core
    [1] => date
    [2] => libxml
    [3] => openssl
    [4] => pcre
    [5] => zlib
    [6] => filter
    [7] => hash
    [8] => pcntl
    [9] => Reflection
    [10] => SPL
    [11] => session
    [12] => standard
    [13] => sodium
    [14] => mysqlnd
    [15] => PDO
    [16] => xml
    [17] => bcmath
    [18] => calendar
    [19] => ctype
    [20] => curl
    [21] => dom
    [22] => mbstring
    [23] => FFI
    [24] => fileinfo
    [25] => ftp
    [26] => gd
    [27] => gettext
    [28] => iconv
    [29] => json
    [30] => ldap
    [31] => exif
    [32] => mysqli
    [33] => pdo_mysql
    [34] => pdo_pgsql
    [35] => pgsql
    [36] => Phar
    [37] => posix
    [38] => readline
    [39] => shmop
    [40] => SimpleXML
    [41] => sockets
    [42] => sysvmsg
    [43] => sysvsem
    [44] => sysvshm
    [45] => tokenizer
    [46] => xmlreader
    [47] => xmlwriter
    [48] => xsl
    [49] => Zend OPcache
)

I also ran print_r(get_loaded_extensions()); within the webserver context (as in: fetching this through a browser, not on the shell)

...
[13] => apache2handler 
[14] => mysqlnd 
[15] => PDO 
[16] => xml 
[17] => bcmath <-------
[18] => calendar 
[19] => ctype 
...

Any sugguestions?

-- Edit

I've now found that the set php version is 7.2 and I know where the php.ini is

0

There are 0 best solutions below