Resolve the call to undefined function Imagettftext () method

Source: Internet
Author: User
Tags bz2

When loading Tipask v2.5 in a new environment, it was found that the background captcha could not be displayed. The error function is Imagettftext (), because index.php use error_reporting (0) will be wrong to hide, leading to this inexplicable error, remove, error immediately appear:

Fatal error:call to undefined function imagettftext ()
Now we have made it clear that the reason for the error is that PHP did not add freetype at compile time.

Solutions

First compile the installation FreeType, take 2.4.0 as an example:

wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.0.tar.bz2
TAR-JXF freetype-2.4.0.tar.bz2
CD reetype-2.4.0
# Install to/usr/local/freetype
./configure–prefix=/usr/local/freetype
Make && make install
Here we recompile PHP, plus the parameters –with-freetype-dir=/usr/local/freetype

./configure–with-freetype-dir=/usr/local/freetype
Compile Complete reboot PHP

KILL-USR2 ' Cat/usr/local/php/var/run/php-fpm.pid '
And then the GD library to find FreeType support instructions installation success!

Note that if the server FreeType version is 1.*, then you may need to change the compilation parameters to –with-ttf[=dir], and the following will be transferred from the Chinaunix forum:

Font configuration Switch
FreeType 1.x to activate FreeType 1.x support, plus –with-ttf[=dir].
FreeType 2 to activate FreeType 2 support, plus –with-freetype-dir=dir.
T1lib to activate T1lib (Type 1 font), plus –with-t1lib[=dir].
Local TrueType String functions to activate support for local TrueType string functions, plus –enable-gd-native-ttf.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.