1

I got this error on a server I setup and was confused:

Error: Call to undefined function Drupal\Component\Utility\imagecreate() in Drupal\Component\Utility\Random->image() (line 282 of /var/lib/jenkins/src/grls/docroot/core/lib/Drupal/Component/Utility/Random.php

2

The imagecreate function is part of php's gd library. If a server has been set up manually it's possible it doesn't have the gd library.

First, figure out which version of php you are using, for example with this command:

dpkg -l | grep '^ii' | grep php

Look for a line like:

ii  php7.2     7.2.19-0ubuntu0.18.04.2           all          server-side, HTML-embedded scripting language (metapackage)

That indicates the server is using php7.2. To install gd library for php7.2 on a system managed with apt you need a command something like:

sudo apt install php7.2-gd

And then the error will be gone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.