php5-gmp in Gutsy & Etch
Update: Added binary for Etch as I am trying to migrate from an old throwaway desktop to a bona fide server running Etch (although it is an old, throwaway, bona fide server).
Update 2: Updated the binary for the latest version of etch in this post
In my last post, I talked about openid and why end users should get it. This time I want to help out any other frustrated wordpress users running Ubuntu Gutsy Server who are trying to implement openid but are getting stuck with the message that says GMP isn’t compiled into php. I found a great tutorial that showed me how to build a package for php5-gmp that works with Gutsy. It took almost an hour to compile it though (my server is elderly and feeble).
I just want to contribute back what I did to get php5-gmp working on gutsy without being too intrusive. I am also going to make the binary avalible for those of you who aren’t comfortable compiling it, however I make no warranty as to it’s functionality or fitness for use (especially in a production environment). I can promise you though that I followed the instructions on the referenced site to the letter.
Here’s the quick and easy way to get php5-gmp working
Run this command to install libgmp
sudo apt-get install libgmp3c2
Download the file here:
php5-gmp built for gutsy i386
php5-gmp built for debian etch i386
Install the package
sudo dpkg -i php5-gmp_523-1ubuntu63_i386.deb
Resolve any dependency issues
sudo apt-get -f install
Now, here is the way that I would recommend since it is not good practice to install unsigned packages (even from me)
Follow these instructions to build and install your pacakge
Original Sources:
http://ubuntuforums.org/showpost.php?p=3198941&postcount=9
http://panthar.org/2006/06/15/php-wi…-on-ubuntu-606
Steps to enter at the command line:
1. apt-get install build-essential debhelper libgmp3c2 libgmp3-dev
(More tools might be needed depending on what you already have installed, but you will tend to get warnings about what is missing)
Then, download the PHP sources:
2. apt-get source php5
My version is 5.1.6, but yours may be different.
Get all the dependencies for building PHP:
3. apt-get build-dep php5
Change into the debian build directory for PHP:
4. cd php5-5.1.6/debian
Let’s edit the modulelist file.
5. gedit modulelist
Insert a line below the one that says
gd GD
with the contents:
Code:
gmp GMP
Next, edit the rules file. Either open it from gedit directly or use:
6. gedit rules
Look for the line that says:
–with-curl=shared,/usr \
Open a line below this with the contents:
Code:
--with-gmp=shared,/usr/local \
Make sure not to forget the backslash on the end. Also, GMP installed itself into /usr/local on my machine. Your location may be different.
Now, we edit the control file. Again, either use the gedit GUI to open the file or type:
7.gedit control
Add this to the end of the file:
Code:
Package: php5-gmp
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, ${php:Depends}, php5-common (= ${Source-Version})
Description:GMP module for php5
This package provides a module for GMP to be used with PHP5.
.
PHP5 is an HTML-embedded scripting language. Much of its syntax is borrowed
from C, Java and Perl with a couple of unique PHP-specific features thrown
in. The goal of the language is to allow web developers to write
dynamically generated pages quickly.
Make sure that you keep all that text as one big block with no extra lines between it. It’s ok to have an extra line after it, but not between it. Just see how the other entries are entered and go from there.
Move up a directory.
8. cd ..
Now, run:
9. sudo dpkg-buildpackage
This will do the whole configure/compile for PHP and create debs in the parent directory. This does take awhile, though. When this process is done, move up to the parent directory:
10. cd ..
And, you will see all of the PHP debs, including the new php5-gmp_[version].deb
Run a dpkg -i on the ones you need (I just used the gmp one):
11.dpkg -i php5-gmp_523-1ubuntu63_i386.deb
May 16th, 2008 at 3:28 pm
[...] my old post for how to compile it on your own if you don’t trust me (which you rightfully [...]
July 3rd, 2008 at 8:37 am
THANK YOU FOR THIS TUTORIAL !
saved much time for me