Apache on CentOS – Fix GMP Extension Recognition Issues

apache-2.4centos7php7

I have this error in running a webapp on a Centos 7, PHP 7.2 server:

PHP Fatal error: Call to undefined function gmp_init() in … a.php on line 2

If I call it from cmd line it works:

b:3

Code:

<?php
$b = gmp_init( 3, 16 );
echo "b:" . $b;
?>

How can I tell apache to load the extension?

thanks

Best Answer

Try installing "php-gmp" on your server using Yum like #yum install php-gmp. It will pull all the available php-gmp version from the repo. Then enable it in your php.ini file like "extension=php_gmp.so".

Related Topic