PHP Fatal error: Call to undefined function ImageTTFBBox

By , last updated December 7, 2019

This error happens when ImageTTFBBox is not available in the pool of PHP functions. To enable this method with PHP on Gentoo, you must build PHP with both GD and TrueType.

Required use flags in /etc/portage/package.use:

# /etc/portage/package.use
dev-lang/php gd truetype

Rebuild PHP with emerge.

emerge -av php

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] dev-lang/php-5.5.24:5.5  USE="apache2 berkdb bzip2 calendar cgi cli crypt ctype curl exif fileinfo filter ftp gd gdbm hash iconv imap ipv6 json mhash mysql mysqli nls opcache pdo phar posix readline session simplexml snmp soap sockets sqlite ssl tokenizer truetype unicode xml xmlreader xmlrpc xmlwriter zip zlib -bcmath -cdb -cjk -debug -embed -enchant (-firebird) -flatfile -fpm (-frontbase) -gmp -inifile -intl -iodbc -kerberos -ldap -ldap-sasl -libedit -libmysqlclient -mssql -oci8-instant-client -odbc -pcntl -postgres -qdbm -recode (-selinux) -sharedmem -spell (-sybase-ct) -systemd -sysvipc -threads -tidy -vpx -wddx -xpm -xslt" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB

Would you like to merge these packages? [Yes/No]

Press enter and wait a moment or two while PHP builds. After it’s done, restart your webserver. I use Apache

/etc/init.d/apache2 restart

Now your TrueType GD functions should be usable and present.