Solution Calltoundefinedfunctionimagettftext ()-PHP source code

Source: Internet
Author: User
Imagettftext is a graphic processing function. If you encounter Calltoundefinedfunctionimagettftext () when using the imagettftext function, the function component is not opened, so we only need simple configuration. Imagettftext is a graphic processing function. If you encounter Call to undefined function imagettftext () when using the imagettftext function, the function component is not opened, so we only need simple configuration.

Script ec (2); script

When Tipask v2.5 is installed in a new environment, the backend Verification Code cannot be displayed. The wrong function is imagettftext (). The error is hidden due to index. php's use of error_reporting (0). This inexplicable error is removed and the error immediately appears:

Fatal error: Call to undefined function imagettftext ()
Now we have made it clear that the cause of the error is that FreeType is not added during PHP compilation.

Solution

First, compile and install 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
Next we will re-compile PHP and add the parameter-with-freetype-dir =/usr/local/freetype.

./Configure-with-freetype-dir =/usr/local/freetype
Compile and restart php

Kill-USR2 'cat/usr/local/php/var/run/php-fpm.pid'
Find FreeType Support in the GD library to indicate that the installation is successful!

Note that if the server freetype version is 1. *, you may need to change the compilation parameter to-with-ttf [= DIR ].

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.