Suite à une erreur (ou pas) il est impossible d’utiliser « imagettftext » sur debian avec la library php-gd. Voici la solution (que je met de côté :p).
(source) & (source pour la correction mysql)
I perform the build from source step, the debian way, for each new PHP5 version. I’ll take on writing a new page to document it properly for Debian, and expanding the existing the instructions for Ubuntu.
The following is a raw dump of my wiki documentation, in case people are curious how to do it before I get this converted to a proper docs page. These docs are for Debian 5.0 Lenny and I copied the steps from a blog post at: http://blog.pirsig.net/apiBlog/entry/compile_php5_gd. I tried to clarify the steps a bit more in my version (which I’ll udpate shortly for the Drupal docs):
Debian Lenny: rebuild php with bundled gd
You have to redo this every PHP version upgrade (after each security update)
first make sure the dependancies are there:
sudo apt-get install apache2-prefork-dev build-essential debhelper fakeroot
Now change to the /usr/src dir, remove any old php5 stuff there:
become root (« sudo su », type your password if required), then:
cd /usr/src rm -rf php5*
Get the PHP5 source and dependencies:
apt-get source php5 apt-get build-dep php5
Now cd to the php5 dir, it will be named slightly differently to match the version you downloaded, and edit debian/rules:
cd /usr/src/php5-5.2.6.dfsg.1 (dir might be diff if the version is not the same) vi debian/rules
search for: –with-gd=shared,/usr and replace with just: –with-gd=shared. The edited line in debian/rules will then read:
--with-gd=shared --enable-gd-native-ttf \
Save debian/rules, and edit debian/setup-mysql.sh:
cd /usr/src/php5-5.2.6.dfsg.1 (dir might be diff if the version is not the same) vi debian/setup-mysql.sh
search for: mysqld > and replace with just: mysqld –user=root >. The edited line in debian/setup-mysql.sh will then read:
mysqld –user=root > $datadir/run.log 2>&1 &
Save debian/setup-mysql.sh, and build the packages with:
dpkg-buildpackage -rfakeroot
(this takes a long time, at least half an hour on a fast machine)
Once done, you will find newly compiled PHP5 packages in /usr/src. One of these will be a php5-gd package that is built using the bundled library.
Install it and hold it so aptitude will not immediately « security update » it with the stock version. Again, change the exact version number here to match the version you just built, the 5.2.6.dfsg.1-1+lenny8_amd64 pat will be different!
cd /usr/src dpkg -i php5-gd_5.2.6.dfsg.1-1+lenny8_amd64.deb
It should output something like this:
(Reading database ... 57949 files and directories currently installed.) Preparing to replace php5-gd 5.2.6.dfsg.1-1+lenny6 (using php5-gd_5.2.6.dfsg.1-1+lenny8_amd64.deb) ... Unpacking replacement php5-gd ... Setting up php5-gd (5.2.6.dfsg.1-1+lenny8) ...
Now mark it not to upgrade, both to dpkg and aptitude:
echo "php5-gd hold" | dpkg --set-selections aptitude hold php5-gd echo "php5-common hold" | dpkg --set-selections aptitude hold php5-common
(this should prevent it from being overwritten the first time you run security updates, which you should check. Make sure it’s not going to reinstall php5-gd as a security update, as the old one will show up as newer. It must be marked as « hold »).
NOTE – you have to be careful accepting security updates, or you will clobber this version with a new one.
NOTE2 – if there is a security update for the rest of the php5 packages, you are probably going to have to repeat this entire process to generate a new, up to date php5-gd. We hold the php5 package as well as php5-gd so you don’t get version mismatches between your main php5 and our custom php5-gd. The versions have to match exactly. So in short Don’t update PHP5 ever without doing this whole procedure (on a test machine first, so you have the package built when you upgrade PHP5 on the other machines). Ctweb04 needs an i386 package so you have to just build on there.
Finally, restart apache:
/etc/init.d/apache2 restart
look at a phpinfo page, under « gd » it should now say:
gd GD Support enabled GD Version bundled (2.0.34 compatible) FreeType Support enabled ...
Enjoy your bundled php5-gd!