Debian uses shared gd library which does not support certain functions e.g. imagerotate(). See:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=298061
Need to manually re-compile from sources to work around this:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=298061
Need to manually re-compile from sources to work around this:
apt-get source libapache2-mod-php5
apt-get build-dep libapache2-mod-php5
cd php5-5.2.0/
sed -i 's/-with-gd=share,\/usr/-with-gd/' debian/rules
debian/rules binary
dpkg -i libapache2-mod-php5_5.2.0-7_amd64.deb

Charles Darke | 6 May 2008