Everyone Debian Admin knows about the Dotdeb packages. Well, Guillaume Plessis is the one to thank for that. He is also the one to thank for the easy method of packaging PHP extensions.
All you need is the “dh-make-php” package (which includes dh-make-pear and dh-make-pecl), the “build-essential” package and the PHP development package. Dependancies for the extensions are something you will need to figure out for yourselves though.
apt-get install dh-make-php php5-dev build-essential
You need to set the environment correctly or you will be needing to type a few options when executing. I prefer to set mine in “~/.bashrc” as follows:
export DEBFULLNAME="First Last" export DEBEMAIL="firstname.lastname@example.org"
Make sure the entries look as above, including the “export”. If not the scripts will not work correctly. Also, make sure to put your name and mail address. ;)
Here's where it starts getting tasty. Now that everything is ready just download the extension you want to install.
pecl download apc-beta
As you can see I have just downloaded the beta APC extension (3.1.13 as of this writing). If you are wanting stable then just leave off the “-beta”.
Now all that is left is building the package itsself:
dh-make-pecl --only 5 APC-3.1.13.tgz cd php-apc-3.1.13/ ./debian/rules binary