Call to undefined function imagettftext ()

Source: Internet
Author: User
Tags php source code

Today will be the company's official website to get local test time, found that the verification code can not be shown, the company's official website used to do with Dede, find the Dede in the include/vdimgck.php, run alone, no error, do not show

Follow the file step-by-step to find the following code

Output text
$LASTC = ';
for ($i =0; $i < $rndcodelen; $i + +)
{
$BC = Mt_rand (0, 1);
$rndstring [$i] = Strtoupper ($rndstring [$i]);
$c _fontcolor = $fontColor [Mt_rand (0,4)];
$y _pos = $i ==0? 4: $i * ($font _size+2);
$c = Mt_rand (0, 15);
@ imagettftext ($im, $font _size, $c, $y _pos, $c _fontcolor, $font _file, $rndstring [$i]);
$LASTC = $rndstring [$i];
}

Originally here has a @ conforms to the @ conforms to remove, again runs, the procedure reported the call to undefined function imagettftext () The error, originally when the GD storehouse appeared the question

The GD library is turned on Via Phpinfo (), but there is no freetype and JPEG support but PNG support

It is estimated that freetype and JPEG are not installed

So the two software is installed

Yum Install freetype*

Yum Install libjpeg*


After the installation, find out where the library is installed.

Find/-name FreeType

Results in the/usr/include/freetype2/folder

Empathy Libjpeg in the/usr/include

Then enter the PHP source code of the PHP source code (downloaded code)/EXT/GD folder in the use of phpize to expand the installation

(My PHP is installed in/usr/local/php)

/usr/local/php/bin/phpize

./configure--with-freetype-dir=/usr/include/freetype2--with-jpeg-dir=/usr/include--with-php-config=/usr/local/ Php/bin/php-config

And then

Make

Make install

This completes the GD library in PHP to recompile

Reboot the Apache service issue to a successful resolution


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.