PDA

View Full Version : DirectAdmin: PHP + Freetype on CentOS 4


nadzri
11-22-2006, 08:28 AM
I'm putting this as a reference for myself :) and hopefully others may find it helpful.

I was looking for an easy way to enable freetype support on PHP for my CentOS 4 vps. This is mainly so I could use one of those captcha scripts to lessen spam on my forum, specifically Joomla+Joomlaboard+com_securityimages. The references I found focused more on compiling GD+freetype whereas I prefer to use rpm packages whenever possible.

Instead of compiling, you can find out if Freetype is already installed by doing
rpm -qa | grep freetype
You are likely to find freetype-version installed, but you will need freetype-devel-version package.
yum install freetype-develshould do the trick. If freetype is not installed, you can do yum install freetype before installing freetype-devel.

Go to /usr/local/directadmin/customapache and edit configure.php to include the text in red.
--with-gd \
--with-gd-dir=/usr/local \
--with-freetype \
--with-freetype-dir=/usr/lib \
--with-gettext \
--with-jpeg-dir=/usr/local/lib \
..
..
--enable-gd-native-ttf
And then,
./build clean
./build php nto compile php. All this as root user.

You should now have freetype support within php. Do a "phpinfo();" to confirm - under gd you should have "FreeType Support - enabled". This is for DirectAdmin on a CentOS 4 vps but I reckon the procedure is quite similar for others - (1)install freetype and freetype-devel (2) configure php with --with-freetype options (3) compile php.

If you're wondering where I got the path /usr/lib, it is from
rpm -ql freetype-devel | grep libttf.so after having installed the package.

Hope that helps.

Usual disclaimer: I am not responsible or liable if you try the above and mess up your machine! :D

sp0di
12-26-2006, 11:34 AM
Just one point that was left out is this GREAT step by step -

Do a

service httpd restart

and make sure it comes backup.

This worked like a charm on a CentOS4.1/Apache2/PHP5 setup :)

nadzri
12-28-2006, 08:48 AM
Hehehe... thanks for pointing that out. It's my first ever how-to.

:)