locked
PHP Fatal error: Call to undefined function imagefttext() RRS feed

  • Question

  • Hi,

    We are using Azure App Service (Linux) and we are getting this error when we try to generate captcha:

    PHP Fatal error:  Call to undefined function imagefttext() in /home/site/wwwroot/lib/pkp/classes/captcha/CaptchaManager.inc.php on line 89

    We found this:

    https://stackoverflow.com/questions/7290958/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.

    So the question is how can we enable those two libraries in our app service so the imagettftext() can work?

    Thank you for your support.

    Tuesday, October 29, 2019 9:41 PM

All replies

  • Wednesday, October 30, 2019 8:17 AM
  • Hi,


    If you need to reconfigure an extension such as GD, please use the following steps.

    1. SSH into your container and run the following
    2. "docker-php-ext-configure gd --with-freetype-dir=/usr --with-jpeg-dir=/usr"
    3. "docker-php-ext-install gd"
    4.  cp /usr/local/lib/php/extensions/no-debug-non-zts-20151012/gd.so /home/site/ext

    To test, run "service apache2 reload" then go your PHP info page to see if the "freetype" is listed under GD. 


    If so, update the "extensions.ini" as shown in the "Adding the Extension" section.  We will need to make some further modifications to avoid a conflict with the GD extension if the site were to be rebooted.  In your Application Settings, add the following so that the "extensions.ini" is loaded before the ones under "/usr/local/etc/php/conf.d"

    Additionally, you can perform the additional steps to move the other INI files to the "/home/site/ini" directory.  In step 3, we'll rename the INI for GD so that it doesn't load the original GD extension on startup but continues to load other extensions.

    1. cp /usr/local/etc/php/conf.d/* /home/site/ini
    2. cd /home/site/ini
    3. mv docker-php-ext-gd.ini docker-php-ext-gd.old

    Please let me know if this helps

    Wednesday, October 30, 2019 12:50 PM