Fatal error:call to undefined function imagettftext ()

Source: Internet
Author: User

Server Environment CentOS

PHP version is 5.6.15, source compiled installation

Compile-time did not compile the FreeType installation, resulting in the error shown in title.

When solving this problem, go a lot of wrong way.

Now take the steps to record the solution.

1. You can use Yum to install some of the required dependent libraries

Yum-y Install libmcrypt-devel mhash-devel libxslt-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-deve L LIBXML2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel Curl curl-devel OpenSSL Open Ssl-devel

2. Enter the PHP source directory, my directory is:/opt/source/php-5.6.15

You can do a clean action first to clear the object file (the file with the suffix ". O") and the executable that resulted from the last make command

Add --with-png-dir--with-freetype-dir--with-jpeg-dir--with-gd at compile time

 My configuration parameters are as follows:

'./configure ' \
'--prefix=/usr/local/php ' \
'--with-mysql=/opt/source/mysql ' \
'--with-config-file-path=/usr/local/php/etc ' \
'--enable-soap ' \
'--enable-pdo ' \
'--with-pdo-mysql ' \
'--with-snmp ' \
'--enable-wddx ' \
'--with-openssl ' \
'--ENABLE-FPM ' \
'--with-mcrypt ' \
'--enable-mbstring ' \
'--with-curl ' \
'--with-mhash ' \
'--enable-zip ' \
'--with-pcre-regex ' \
'--enable-sysvsem ' \
'--enable-sysvshm ' \
'--enable-pcntl ' \
'--enable-mbregex ' \
'--enable-inline-optimization ' \
'--with-bz2 ' \
'--with-zlib ' \
'--enable-sockets ' \
'--with-png-dir ' \
'--with-freetype-dir ' \
'--with-jpeg-dir ' \
'--WITH-GD ' \
'--with-mysqli ' \

Not surprisingly, this will successfully configure success, generate the configuration file, and then execute make && make install

3. After the successful compilation, remember to use the compiled PHP to replace the environment variables in the PHP command (if you put your local PHP compilation environment into the environment variables, this step can be ignored)

For example, I will execute the following two commands:

cp/usr/local/php/bin/php/usr/bin/php

cp/usr/local/php/sbin/php-fpm/usr/sbin/php-fpm

Run Phpinfo () to see if a three line in the red box indicates that the installation was successful

Fatal error:call to undefined function imagettftext ()

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.