Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm not able to compile freetype support in php...

My configure command is:

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --enable-bcmath 
--enable-zip --with-zlib --with-gd --with-jpeg-dir=/usr/lib --with-mysqli 
--enable-mbstring --with-pdo-mysql  --with-pgsql=/usr/lib/pgsql 
--with-freetype-dir=/usr/lib --enable-gd-native-ttf

and it runs fine (doesn't complain about anything), compilation is succesful too, but in the end freetype support is not enabled:

["GD Version"]=> string(27) "bundled (2.0.34 compatible)" 
["FreeType Support"]=> bool(false)
["T1Lib Support"]=> bool(false) 

/usr/lib looks like the right place to look for freetype:

# pwd
# ll|grep -i freetype
lrwxrwxrwx   1 root root       21 Dec 10 13:35 ->
lrwxrwxrwx   1 root root       21 Dec 10 13:35 ->
-rwxr-xr-x   1 root root   525448 Nov 16 17:55

OS is Centos Linux 5, php version is 5.2.17.

Any hints? Thanks!

share|improve this question
config.log would show why it isn't detecting freetype. – Mark Wagner May 16 '11 at 16:33

2 Answers 2

On CentOS you could just use yum and perform the install.

First I'd do the command below and see what results are given and then issue the yum command to install php-gd:

rpm -qa | grep php
yum install php-gd

Make sure you run these as root so you have the permission for the install

share|improve this answer

Since this question is about compiling PHP with FreeType support and not installing it, I wanted to add to this just in case someone else (like me) is having this problem and needs to compile a version of PHP that isn't available as a package.

  1. First, you will need the FreeType library installed either by downloading and compiling it from or by installing the package available with your operating system.
  2. The first problem is the path specified with --with-freetype-dir isn't correct. You want the include directory and not the lib directory of freetype. In my case (on CentOS v6.7), the directory was /usr/include/freetype2. You can find this by running find / -name freetype2.
  3. Now that part is sorted, you can run ./configure with the --with-freetype-dir argument that was determined above. In the case of this question, the full command would be ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --enable-bcmath --enable-zip --with-zlib --with-gd --with-jpeg-dir=/usr/lib --with-mysqli --enable-mbstring --with-pdo-mysql --with-pgsql=/usr/lib/pgsql --with-freetype-dir=/usr/include/freetype2 --enable-gd-native-ttf
  4. If you already compiled PHP before this, you need to run make clean first. The configuration has changed so all of the objects to wiped be recompiled.
  5. Run make and then make install to compile PHP.
  6. Verify that FreeType is installed by running php -i or viewing the output of phpinfo();. If using a web server, you may need to restart it for the changes to come into effect.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.