PHP Fatal error: Call to undefined function imagettftext()
According to the PHP manual entry for imagettftext()
:
You must be missing one or both of the required libraries in your PHP build.This function requires both the GD library and the » FreeType library.
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 withsudo 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
A Better Way to Replace Emoticons in PHP
How to Add Filter or Hook for "Woocommerce_Add_To_Cart"
How to Make a Chat Room Script with PHP
Prevent Back Button After Logout
Best Way to Identify a User Uniquely
Laravel - Validate File Size When PHP Max Upload Size Limit Is Exceeded
Rounding Up to the Second Decimal Place
PHP MySQL Group by to Get Latest Record, Not First Record
Woocommerce Cart Quantity Base Discount
"Call to Undefined Function" Error When Calling Class Method
How to Increase by 1 All Keys in an Array
Find Windows 32 or 64 Bit Using PHP
Call to Undefined Function Curl_Init() - with Wamp
How to Add Item to the JSON File Formatted Array
How to Get an Array of Data from $_Post
How to Add Custom Fields to Woocommerce Registration Form
Check Image Dimensions (Height and Width) Before Uploading Image Using PHP