How to Compile the GD PHP Extension

Sometimes the lsphp-gd package is not up-to-date, in which case it may be missing some features, like WebP support. If this happens, you can manually compile the GD extension to include the new features.

yum install -y lsphp73-devel gcc libjpeg-turbo-devel libpng-devel libXpm-devel freetype-devel libwebp-devel

In this example we use lsphp73. Please change it to another appropriate PHP version number if necessary.

tar xzvf php-7.3.12.tar.gz
cd php-7.3.12
cd ext
cd gd
./configure --with-php-config=/usr/local/lsws/lsphp73/bin/php-config --with-webp-dir=/usr/include/webp --with-freetype-dir=/usr/include/freetype2/freetype --with-jpeg-dir=/usr/include --with-png-dir=/usr/include --with-xpm-dir=/usr/include
make install

Restart lsphp if necessary, and check the PHPinfo page again.

  • Admin
  • Last modified: 2019/11/29 16:04
  • by Lisa Clarke