PHP GMP not found when using from command line?

Clash Royale CLAN TAG#URR8PPP
PHP GMP not found when using from command line?
When i try to use php -f file.php it says :
php -f file.php
Uncaught Error: Call to undefined function gmp_init() in /file.php:10
However when I add the script as a function to my wordpress site, it doesn't give error and works. What can be the problem?
Using php7.1-fpm
2 Answers
2
gmp_init() is not loaded whrn you are doing php -f file.php. Add
var_dump(function_exists('gmp_init'));
at the top of file.php to confirm.
If you have few versions of php and only one has GMP installed, you should run a command with php version.
php7.1 -f file.php
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Maybe, but how do I load it then? It's a library in /etc/php/php7.1/
– Sam Tyurenkov
Apr 2 at 10:39