We are in the midst of upgrading from 5.3.10 to 5.4 and couldn’t find a debian package for it.The current stable version is 5.4.10 but this changes often and I wanted to automate the compiling and packaging process.First thanks to Jordan Sissel who is a bad ass sysadmin/developer and who wrote fpm which I’m using here to create the debian package.
The end result is a script that will install prerequisite pacakges, download, compile and package which ever php version you specify.
The basic process is:
1 install the prerequisite packages needed to compile
2 download the php source
6 make install but do this while changing its destination directory
7 create the package
Step 6. is where php got a little tricky.In the fpm wiki page which describes how to package something that uses make install ( https://github.com/jordansissel/fpm/wiki/PackageMakeInstall )It has you changing the destination directory in the make install process by specifying:
make install DESTDIR=/tmp/installdir
However this didn’t work with php, instead I had to specify the install_dir:
INSTALL_ROOT=/tmp/installdir make install
FPM is really simply to use, also because its a ruby gem is easy to install.To create the package I’m using the following command:
fpm -s dir -t deb -n php -v 5.4.10 -p "libmcrypt-dev" -p "libt1-dev" --deb-user root -p php-VERSION_ARCH.deb --description 'php 5.4.10 compiled for apache2' -C /tmp/installdir etc usr
Its pretty self explaintory but a few things I’ll point out are “-p” which are packages that are dependancies, and “etc” & “usr” are the sub directories to /tmp/installdir which you want packaged up.