Call to undefined function Imagettftext solution

Source: Internet
Author: User
posted by Old high in 2014-10-03 in Code life classification

Old Gao in a new environment when the DEDECMS found that the background verification code cannot be displayed. Direct search for this error, some people say that the session error, and some say permission error, and so on, this is not nonsense! can only see the source code, to locate the file /include/vdimgck.php . The function of error is that because of the use of the dream of the mistake of the imagettftext() @ hidden, leading to this inexplicable error. To be @ removed, the error appears immediately:

Fatal error:call to undefined function imagettftext ()

Now we are clear that the reason for the error is that PHP was compiled without adding freetype.

Workaround:

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.bz2tar -jxf freetype-2.4.0.tar.bz2cd reetype-2.4.0# 安装到/usr/local/freetype./configure --prefix=/usr/local/freetypemake && make install

Here we recompile PHP, plus the parameters--with-freetype-dir=/usr/local/freetype

./configure \... \... \--with-freetype-dir=/usr/local/freetype

Compile to complete restart PHP

kill -USR2 `cat /usr/local/php/var/run/php-fpm.pid`

Again the GD library to find FreeType Support instructions for installation success!

It should be noted that if the server FreeType version is 1.*, then you may need to change the compilation parameters for --with-ttf[=DIR] the following to go 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.

Reference:

Http://bbs.chinaunix.net/thread-610205-1-1.html

The above describes the call to undefined function Imagettftext solution, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    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.