安装

In order to have these functions available, PHP must be compiled with GMP support by using the --with-gmp option.

User Contributed Notes

Elydreams Trend 23-Oct-2021 09:03
On Debian platforms, make sure you install the gmp development library first:

    sudo apt-get install libgmp-dev

Just like other extensions, you need the libs installed before php compile will gracefully complete all.
1602352639 at qq dot com 26-Jun-2020 11:07
ubuntu

sudo apt install php-gmp
oharry0535 at gmail dot com 08-Feb-2019 07:51
Under Windows you will need to un-comment the line in your php.ini file

;extension=gmp

within the php.ini and restart Apache.
insign at gmail dot com 10-Nov-2016 08:00
Simple run:
   sudo apt install php7.0-gmp
sean at crazyhorsecoding dot com 28-Dec-2013 08:45
on Ubuntu Server:

sudo apt-get install libgmp-dev
sudo apt-get install php5-gmp
sudo service apache2 reload
omagaldadze at yahoo dot com 04-May-2013 09:41
On ArchLinux php 5.4.14-1 I had to uncomment the line

extension=gmp.so

in /etc/php/php.ini file.

Probably, restart of web server (e.g. Apache) is required if working from web.
mike dot mackintosh at angrystatic dot com 01-Apr-2013 03:07
On Debian platforms, make sure you install the gmp development library first:

    sudo apt-get install libgmp-dev

Just like other extensions, you need the libs installed before php compile will gracefully complete.
admin at ee-dd dot com 03-Oct-2011 09:18
on ubuntu you can get it from Synaptic Package Manager
just search words "gmp",you'll find it.
MiquelFire 24-Aug-2009 12:40
With PHP 5.3 on Windows, you need to use the VC9 build, otherwise you will not have the dll to enable GMP
Chris 02-Mar-2009 11:49
Under Windows you will need to uncomment the line

;extension=php_gmp.dll

within the php.ini and restart Apache.
arancaytar dot ilyaran at gmail dot com 30-Dec-2008 11:48
Note that this parameter requires a path, as in --with-gmp=DIR, if gmp is installed in a non-standard location, which is almost always the case when you are building your own PHP installation in your home directory.

Obvious, but it's an easy mistake.
PHP8中文手册 站长在线 整理 版权归PHP文档组所有