Installing PHP5 on Debian-testing
PHP5 is a distinct improvement over the v4 language, but for those of us who prefer to manage our software with the apt package management tool, the lack of an official debian package for it can put a damper on things.
However it's quite possible to install PHP5 from a tarball and hook it up to a standard debian apache 1.3 install. The trick lies in trying to match up the functionality that comes with the standard debian PHP4 install.
The solution - as with compiling most things in debian - consists of having the right "-dev" packages installed - this contains all the library headers and tools that are required to link against the libraries debian provides. As a general rule, if you're having trouble compiling against a library, and dpkg/apt think you have it installed, try installing the dev package as well. The dependencies of most packages won't include them, as they're not actually required to run the code, only to build it.
The "-dev" package for a library has the same package name as that library, but with -dev added on the end.
The packages I found I needed to compile PHP5.03 were as follows:
libxpm-dev libgd2-xpm-dev libt1-dev libldap2-dev libmhash-dev libpcre3-dev libmm-dev libsnmp5-dev apache-dev unixodbc-dev flex libxml2-dev libmysqlclient14-dev libgd2-dev
There are probably more, but those are the ones I had to add manually on my server. I can't figure which mysql package/s are actually required though, although I suspect some must be.
This allowed me to compile PHP5 with the following fairly complete set of options, based on the output of PHP4's phpinfo() command on a standard install. Not all switches are included as I couldn't find all of the libraries they needed. Additionally, there was a conflict between --with-recode and some other options, so I dropped it.
./configure --prefix=/usr --with-apxs=/usr/bin/apxs --with-regex=php --with-config-file-path=/etc/php5/apache --disable-rpath --disable-debug --enable-memory-limit --enable-calendar --enable-sysvsem --enable-sysvshm --enable-track-vars --enable-trans-sid --enable-bcmath --enable-ctype --with-iconv --enable-exif --enable-filepro --enable-ftp --with-gettext --enable-mbstring --with-pcre-regex=/usr --enable-shmop --enable-sockets --enable-wddx --with-xml=/usr --with-expat-dir=/usr --enable-yp --with-zlib --without-pgsql --disable-static --with-layout=GNU --with-dom=shared,/usr --with-zlib-dir=/usr --with-gd
=shared,/usr --with-jpeg-dir=shared,/usr --with-xpm-dir=shared,/usr/X11R6 --with-png-dir=shared,/usr --with-freetype-dir=shared,/usr --with-ldap=shared,/usr --with-mcal=shared,/usr --with-mhash=shared,/usr --with-mm --with-mysql=shared,/usr --with-unixODBC=shared,/usr --enable-xslt --with-xslt-sablot=shared,/usr --with-snmp=shared --enable-ucd-snmp-hack --with-ttf=shared,/usr --with-t1lib=shared,/usr
NB: Ensure php.ini is in the expected location or some functions won't be available. If you're upgrading from PHP4, you can probably just copy the same one to the new location.