Can´t use the GMP library

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Can´t use the GMP library

Postby jose » 20. October 2005 10:10


I have XAMPP for Linux 1.4.13 (in a Red Hat Linux 9) and I need for one of my applications the GMP library. I have installed the library as they recommend in ( but I don´t know how to make PHP aware of this new library. Do I have to rebuilt or compile PHP again? I mean, I don´t see this library when running phpinfo(). I´ve been looking in all directories where I installed XAMPP for the configure file but I cannot find it.

I have added the /usr/local/lib to the /etc/ and run the program ldconfig but I get the same error when I test my application:
"Fatal error: Call to undefined function gmp_init() in /opt/lampp/htdocs/TPR_WEB/test.php on line 2
I have also added the /usr/local/lib path to the LD_LIBRARY_PATH environment variable, but nothing.

Any help would be really appreciate it!
Posts: 6
Joined: 20. October 2005 09:51

Postby jose » 21. October 2005 15:41

Since I couldn´t find this configure script I decided to install a new fresh version of PHP and see what happens. But it is easier said than done. However, I think I have now installed PHP and some other libraries needed to install PHP.

Still I have problem with this GMP library because I cannot call the methods in this library, despite of I have installed it and recompile PHP with the --with-gdm flag.

Does anyone know what I am doing wrong or what I am missing?

Thanks in advance!
Posts: 6
Joined: 20. October 2005 09:51

Postby Oswald » 21. October 2005 15:45

Dear Jose!

You need to recompile PHP completely. But that is not easy to explain and a too big story to describe in a forum entry.

You can find all used configures in /opt/lampp/share/lampp/configures.tar.gz

Many greetings and good luck
User avatar
Apache Friends
Posts: 2718
Joined: 26. December 2002 19:51
Location: Berlin, Germany
Operating System: Linux

Postby Wiedmann » 21. October 2005 16:27

Hallo Jose, Kai.

IMHO you can build this extension as shared extension also (with phpize). So, with the XAMPP devel-package, there should not be the necessity to recompile PHP again.
AF Moderator
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby jose » 24. October 2005 08:34


Thank you both for helping me out. I am trying with phpize to enable this new extension but I can´t run this phpize script/program. :?

I do as follow:
>cd extname
Configuring for:
PHP Api Version: 20031224
Zend Module Api No: 20041030
Zend Extension Api No: 220040412 /usr/bin/m4: ERROR: Recursion limit of 1024 exceeded, use -L<N> to change it.

I´ve been looking for info in Google, but I can´t find any solution.
Any ideas?

Thank you!
Posts: 6
Joined: 20. October 2005 09:51

Postby jose » 25. October 2005 10:01


Well, I fixed this problem by doing what I didn´t want to: uninstalling and installing again XAMPP.

It seemed that after all installing and uninstalling of some libraries and compilations of PHP it created dependencies or something like that, so when building PHP it complained about almost everything.

Anyway, now it is done and it works. The only thing I had to do before using phpize was setting the environment variable like this: (redhat 9)
> export PHPIZE=/opt/lampp/bin/phpize

Posts: 6
Joined: 20. October 2005 09:51

Re: Can´t use the GMP library

Postby greno » 04. December 2010 00:36

Ok, it's five years later but this thread is my exact problem as well.

I am running XAMPP 1.6.4

I needed at add an extension for GMP. So I downloaded GMP 5.0.1 and set about to phpize it and create a GMP extension module.

Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
/usr/bin/ recursion limit of 1024 exceeded, use -L<N> to change it
autom4te: /usr/bin/m4 failed with exit status: 1

But, as you can see m4 is infinitely recursing for some reason. So elsewhere I created a whole new download of xampp-1.6.4 and xampp-devel-1.6.4 and tried again but got the exact same results with completely fresh download.

So I'm thinking maybe it's GMP 5.0.1, so I download GMP 4.2.3 and tried with it but I get the exact same error again.

Has anyone else tried this recently and successfully phpize GMP library for XAMPP?

Posts: 54
Joined: 04. October 2006 19:25

Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 10 guests