PHP Fatal Error: Call to Undefined Function Imagettftext()

PHP Fatal error: Call to undefined function imagettftext()

According to the PHP manual entry for imagettftext():

This function requires both the GD library and the » FreeType library.

You must be missing one or both of the required libraries in your PHP build.

Call to undefined function imagefttext()

There seem to be at least two .configure flags missing:

 --with-freetype-dir=/usr --enable-gd-native-ttf

see the GD installation instructions.

circleci: Fatal error: Call to undefined function imagettftext()

the following worked for me (using the circleci/php:7.3.6-fpm-stretch-browsers image):

sudo apt-get install libfreetype6-dev

sudo docker-php-ext-configure gd --with-freetype-dir=/usr/include/freetype2/

before installing the gd extension with

sudo docker-php-ext-install intl gd

the link that led me to the solution:
https://docs.docker.com/samples/library/php/ (PHP Core Extensions section)

Call to undefined function imagettfbbox()

I noticed when running php -a that there was an error saying PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/gd.so' - libvpx.so.0: cannot map zero-fill pages: Cannot allocate memory in Unknown on line 0. Due to this being a production system I don't have errors showing on the webserver but I do feel stupid now.

I traced the error back to a question on StackOverflow which informed me I needed swap space on my VM which I fixed by running:

sudo dd if=/dev/zero of=/swapfile bs=1024 count=512k
sudo mkswap /swapfile
sudo swapon /swapfile

Well done to cOle2 for spotting this whilst I was writing this up.

Thanks for your help.

imagettfbbox() Cant Open .ttf font

according to
http://php.net/manual/en/function.imagettfbbox.php

 This function requires both the GD library and the » FreeType library. 

You must be missing one or both of the required libraries in your PHP build.

build file 'info.php' with this code:

<?php phpinfo() ?>

run it and see which are missing, then go and install it/them.



Related Topics



Leave a reply



Submit