PHP GD Library Add FreeType extension method

Source: Internet
Author: User
This article is mainly to share to you about the PHP GD library to add FreeType expansion method, the need for friends can refer to

Background: The business needs to use the Imagefttext function, found that the GD library was installed at the beginning of the installation did not add FreeType

Linux version CentOS 6.6

installation process (because the server is a distributed intranet server and cannot be installed with Yum, the following are compiled installations after downloading the resource bundle):

Installing FreeType

Decompression freetype-2.3.9.tar.gz

Compiling the installation

./configure--enable-static--enable-shared (no prefix specified,. h files are installed by default to/usr/local/include,. a|. So files are installed by default to the installation of additional resource packs within/usr/local/lib If no directory is specified also to this location)

Make && make install

Verify that the FreeType installation is successful, recompile the installation of the GD library, add freetype support

Install GD Library, version 2.0.35

Since there is a previous installation record, it is recommended that clean be made, otherwise it may cause the installation to fail

./configure--enable-shared--with-jpeg=/usr/local/include/--with-freetype=/usr/local/--with-png=/usr/local/ include/(note here is that the--with-freetype=/usr/local/path begins with/usr/local/lib, the result has been introduced FreeType failure, estimated because the header file is not within this directory, Introduced successfully after changing to the top level directory)

Confirm support for Freetype 2.x Library:yes

Make && make install

Verify that the installation is successful recompile the installation of the GD extension PHP

PHP version 5.5.38

Installing GD expansion module separately requires CD to PHP-5.5.38/EXT/GD

Execute phpize Build the compiled file, if the system does not introduce phpize, this file in the PHP installation directory in the bin

Be sure to do clean here first, this time installed 8 servers, did not first do clean 100% did not install successfully, are not added to FreeType support

./configure--with-php-config=/opt/php5.5.38/bin/php-config--with-jpeg-dir--with-png-dir--with-freetype-dir-- With-zlib-dir--WITH-GD

Confirm that FreeType 2 has been added in the compilation

Make && make install

Verify that the newly generated. So file is the same as the path introduced by php.ini, if you need to modify the extension in php.ini

Restart PHP-FPM after successful installation

PS Axu |grep php |grep-v ' grep ' |awk ' {print $} ' |xargs kill-9

/php5.5.38/sbin/php-fpm

After a successful reboot, see if GD in Phpinfo contains

FreeType Support Enabled

FreeType Linkage with FreeType

FreeType Version 2.3.9

Finished

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.