On Amazon Linux 2 for elastic beanstalk php, it comes with freetype 2.3.11 which doesn't render fonts correct for my project so I downloaded freetype 2.10.1 and built without/with harfbuzz according to http://www.linuxfromscratch.org/blfs/view/svn/general/freetype2.html. Then I compiled the php gd extension as follows.

cd php-7.2.19/ext/gd
./configure --with-php-config=/usr/bin/php-config --with-gd --with-freetype-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr --with-webp-dir=/usr
sudo cp modules/gd.so /usr/lib64/php/7.2/modules/

but when I run php -v I get "PHP Warning: PHP Startup: Unable to load dynamic library 'gd.so' (tried: /usr/lib64/php/7.2/modules/gd.so (/usr/lib64/php/7.2/modules/gd.so: undefined symbol: php_gd_gdImageJpegCtx), /usr/lib64/php/7.2/modules/gd.so.so (/usr/lib64/php/7.2/modules/gd.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0"


I was missing --with-jpeg-dir=/usr from the configure command. I would have thought that if something like that was wrong it wouldn't have compiled but I guess not. It now works.

$ php -i | grep -i "freetype"
FreeType Support => enabled
FreeType Linkage => with freetype
FreeType Version => 2.10.1
| improve this answer | |

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.