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

Comments (2)
Very helpfull and was good up untill the sed command. Endless loop that never ended ... I really need the imagerotate function unfortunately.
Written by Guest: Dennis at 2:38pm, 24 April 2009.it still works the same way in 2010, just fit the path and filenames.
apt-get source libapache2-mod-php5
apt-get build-dep libapache2-mod-php5
cd php5-###version-specific###
sed -i 's/-with-gd=share,\/usr/-with-gd/' debian/rules (replaces "-with-gd=share,/usr" with "-with-gd" in debian/rules)
debian/rules binary (executing debian/rules with parameter binary)
dpkg -i libapache2-mod-php5###specific###.deb
apt-get source libapache2-mod-php5
apt-get build-dep libapache2-mod-php5
cd php5-###version-specific###
sed -i 's/-with-gd=share,\/usr/-with-gd/' debian/rules (replaces "-with-gd=share,/usr" with "-with-gd" in debian/rules)
debian/rules binary (executing debian/rules with parameter binary)
dpkg -i libapache2-mod-php5###specific###.deb
Written by paul.w at 8:44am, 21 April 2010.
Charles Darke | 6 May 2008