Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When calling a gmp math function like gmp_mod, I get:

Fatal error: Call to undefined function gmp_mod()

I have installed the php5-gmp package and restarted the web-server, and the function is still undefined. The server is running Ubuntu 10.04 and PHP is running as an Apache module. All software was installed from official packages.

How do I enable the GMP math functions in PHP? I'm looking for a solution that uses official packages, not compiling from source.

share|improve this question

Here is the way which worked for me :

  1. Installed GMP with apt-get install php5-gmp
  2. Added to php.ini

Et voilà !

phpinfo() sample :

gmp support     enabled
GMP version     4.3.2 

It works fine here (Debian), so I suppose it will be ok for Ubuntu too.

share|improve this answer
On Ubuntu 12.04 LTS, I needed to use, not I also needed to restart Apache for the changes to take effect (not surprising as I'm using mod_php). – Calrion Jan 26 '14 at 23:52
In my case sudo apt-get install php5-gmp automatically updated php.ini and restarted Apache. – KalenGi Dec 3 '14 at 23:52

protected by Michael Hampton Oct 14 '15 at 15:08

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.