环境

  • CentOS 6.4
  • Xampp 7.1.12

首先下载 PHP7.1.12 的源码包

yum install gmp-devel
yum install m4
tar -xvf php-7.1.12.tar.xz 
cd /root/php-7.1.12/ext/gmp
/opt/lampp/bin/phpize
./configure  --with-php-config=/opt/lampp/bin/php-config
make && make install
/opt/lampp/bin/php -m | grep gmp
/opt/lampp/lampp reloadapache

reload apache 之前 记得在 php.ini里面 写extension="/opt/lampp/lib/php/extensions/no-debug-non-zts-20160303/gmp.so"