Alt-PHP-Faq
Cheapest CO.UK domains in the UK! £1.88 per year!
And PHP/MySQL hosting 1p/1c for the first month, NO CATCH!


Question :

I am trying to install GD + Truetype with PHP4, but all I get is libgd was not built with TrueType font support

Answer :
*Note*
This answer may or may not help you. This is the way we got it to work, maybe it will help you. If it does please contact altphp@php4hosting.com so we know and can help others.
--

GD 1.x
-------
We had this trouble when trying to install the following combination.
PHP-4.2.3,gd-1.8.4 + freetype-2.1.3

Firstly freetype-2.1.3
wget http://telia.dl.sourceforge.net/sourceforge/freetype/freetype-2.1.3.tar.gz
tar -pxzf freetype-2.1.3.tar.gz
cd freetype-2.1.3
make setup
make
make install
cd ..

Then GD
wget http://www.boutell.com/gd/http/gd-1.8.4.tar.gz
tar -pxzf gd-1.8.4.tar.gz
cd gd-1.8.4

Then edited Makefile
Found the line that had the following
CFLAGS=-O -DHAVE_LIBPNG -DHAVE_LIBJPEG
And replaced with
CFLAGS=-O -DHAVE_LIBPNG -DHAVE_LIBJPEG -DHAVE_LIBFREETYPE

Then found the line
LIBS=-lgd -lpng -lz -lm
and replaced with
LIBS=-lgd -lpng -lz -ljpeg -lfreetype -lm

Then found the line
INCLUDEDIRS=-I. -I/usr/include/freetype2 -I/usr/include/X11 -I/usr/X11R6/include/X11 -I/usr/local/include
and replaced with
INCLUDEDIRS=-I. -I/usr/local/include/freetype2 -I/usr/include/X11 -I/usr/X11R6/include/X11 -I/usr/local/include

This last line needed edited as freetype-config showed the include libraries were not in /usr/include/freetype2 but in /usr/local/include/freetype2 Yours may vary

To find our your freetype library include paths use the following :-
freetype-config --cflags

Ours gave :-
-I/usr/local/include/freetype2

Then run
make
make install

Now time to install PHP, we used the following configure options :-
./configure --prefix=/usr/local/apache/php --with-mysql=/usr/local/mysql --with-pgsql=/usr/local/pgsql --enable-track-vars --enable-bcmath --enable-ftp --with-gd --enable-gd-native-tt --with-freetype-dir --with-imap --with-png-dir --with-jpeg-dir --with-dom=/usr/local --with-zlib-dir --enable-trans-sid --with-mcrypt=/usr/local --with-mhash=/usr/ --with-curl --with-openssl=/usr/local/ssl --with-apxs=/usr/local/apache/bin/apxs

make
make install

Restart apache and try the following test script

The initial install seemed to go well and the PHPInfo paged showed :-
FreeType Support enabled
FreeType Linkage with freetype


But when trying to use the following code :-

<?php
//Header ("Content-type: image/jpeg");
$im imagecreate (40030);
$black ImageColorAllocate ($im000);
$white ImageColorAllocate ($im255255255);
ImageTTFText ($im2001020$white"/home/user/web/arial.ttf",
            
"Testing... Omega: Ù");
ImageJpeg ($im);
ImageDestroy ($im);
?>


It gave the error :-
Warning: libgd was not built with TrueType font support in /home/admin/web/font.php on line 7

The arial.ttf font was taken from a windows install and uploaded as binary. We had edited the GD Makefile for jpeg and Truetype support and PHP had said it was available in the initial configure and the phpinfo page.

After some reading of many sites it was found that GD-1.8.x does not support TrueType version 2.

So we tried again using GD-2.0.1, the same error!

Finally we did a fresh install of GD-1.8.4 to see what files were created (They are listed after a make install)

So we removed them using the following :-
rm /usr/local/lib/libgd.a
rm /usr/local/bin/pngtogd
rm /usr/local/bin/pngtogd2
rm /usr/local/bin/gdtopng
rm /usr/local/bin/gd2topng
rm /usr/local/bin/gd2copypal
rm /usr/local/bin/gdparttopng
rm /usr/local/bin/webpng
rm /usr/local/bin/bdftogd
rm /usr/local/include/gd.h
rm /usr/local/include/gdcache.h
rm /usr/local/include/gd_io.h
rm /usr/local/include/gdfontg.h
rm /usr/local/include/gdfontl.h
rm /usr/local/include/gdfontmb.h
rm /usr/local/include/gdfonts.h
rm /usr/local/include/gdfontt.h

Then went back to try an install of GD-2.0.8.

wget http://www.boutell.com/gd/http/gd-2.0.8.tar.gz
tar -pxzf gd-2.0.28.tar.gz
cd gd-2.0.28
./configure
make
make install
cd ..
ldconfig

Now time to install PHP.

* NOTE *


Then we used the following configure options :-

wget http://www.php.net/distributions/php-4.2.3.tar.gz
tar -pxzf php-4.2.3.tar.gz
cd php-4.2.3

./configure --prefix=/usr/local/apache/php --with-mysql=/usr/local/mysql --with-pgsql=/usr/local/pgsql --enable-track-vars --enable-bcmath --enable-ftp --with-gd --enable-gd-native-tt --with-freetype-dir --with-imap --with-png-dir --with-jpeg-dir --with-dom=/usr/local --with-zlib-dir --enable-trans-sid --with-mcrypt=/usr/local --with-mhash=/usr/ --with-curl --with-openssl=/usr/local/ssl --with-apxs=/usr/local/apache/bin/apxs

The important ones being :-
--with-gd --enable-gd-native-tt --with-freetype-dir

Then
make
make install

Restart apache and our test php script worked!

If you have build problems with php or apache you might try and do a make clean on both directories to get it to compile properly.

Hope that helps someone.

This has helped many people that we know of plus has been installed on our servers and works without fail!

Good luck!



Categories Return to Main PHP Faq

Installation

 

Questions

Installation
How to install PHP on Apache?
How do I install Apache, MySQL, PHP on Linux?
How did you install PHP with --mcrypt and --mhash?
When using GD/PHP to create thumbnails using imagecopyresized the thumbnail quality is not very good.
Can I compile php with mysql without having mysql sources?
How do I install PHP as a CGI?
How do I stop spammers using header injection with my PHP Scripts? (Webmasters)
How can I get PWS (Microsoft Personal Webserver) to work?
I have errors trying to install libxml so I can use --with-dom for PHP (checking for DOM in default path... not found)?
How do I install Sablotron with PHP?
Is there a Windows version of MySQL?
Is there an archive that installs mysql,php4,apache and perl on a windows system?
What do I have to do to convert PHP3 pages to PHP4 pages? Are there any compatibility problems?
I'm trying to compile PHP 4.1.1 on a SunOS 5.8 box as a DSO module with mcrypt 2.4.18 (i.e. libmcrypt.so.4.2.8), I get loads of errors.
Installing MySQL Perl Modules DBI
How do I install Sablotron to work with PHP on Windows?
How do I install the PostGRESQL client librarys so PHP can talk to remote PGSQL servers?
What version should I install?
make install gives an error saying i need LoadModule line in httpd.conf but its already there
Use ereg_replace to replace only the first occurence of a string instead of all?
error: conflicting types for `XML_FEATURE_UNICODE'
How do I stop spammers using header injection with my PHP Scripts? (Server Admin)
How do I install Curl?
Installing ioncobe with php5.2.3 gives the error Failed loading ioncube_loader_lin_5.2.so: ioncube_loader_lin_5.2.so: undefined symbol: zend_hash_destroy
 

Return to the main FAQ list



Free Forum    
Design & Layout Copyright © 2000- 2006 PHP MySQL Web Hosting Comments to Webmaster
Hosted by PHP 4 Hosting - PHP and MySQL Webhosting and Domain Names